You can subscribe to this list here.
2001 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}
(10) 
_{Aug}
(5) 
_{Sep}
(3) 
_{Oct}
(41) 
_{Nov}
(41) 
_{Dec}
(33) 

2002 
_{Jan}
(75) 
_{Feb}
(10) 
_{Mar}
(170) 
_{Apr}
(174) 
_{May}
(66) 
_{Jun}
(11) 
_{Jul}
(10) 
_{Aug}
(44) 
_{Sep}
(73) 
_{Oct}
(28) 
_{Nov}
(139) 
_{Dec}
(52) 
2003 
_{Jan}
(35) 
_{Feb}
(93) 
_{Mar}
(62) 
_{Apr}
(10) 
_{May}
(55) 
_{Jun}
(70) 
_{Jul}
(37) 
_{Aug}
(16) 
_{Sep}
(56) 
_{Oct}
(31) 
_{Nov}
(57) 
_{Dec}
(83) 
2004 
_{Jan}
(85) 
_{Feb}
(67) 
_{Mar}
(27) 
_{Apr}
(37) 
_{May}
(75) 
_{Jun}
(85) 
_{Jul}
(160) 
_{Aug}
(68) 
_{Sep}
(104) 
_{Oct}
(25) 
_{Nov}
(39) 
_{Dec}
(23) 
2005 
_{Jan}
(10) 
_{Feb}
(45) 
_{Mar}
(43) 
_{Apr}
(19) 
_{May}
(108) 
_{Jun}
(31) 
_{Jul}
(41) 
_{Aug}
(23) 
_{Sep}
(65) 
_{Oct}
(58) 
_{Nov}
(44) 
_{Dec}
(54) 
2006 
_{Jan}
(96) 
_{Feb}
(27) 
_{Mar}
(69) 
_{Apr}
(59) 
_{May}
(67) 
_{Jun}
(35) 
_{Jul}
(13) 
_{Aug}
(461) 
_{Sep}
(160) 
_{Oct}
(399) 
_{Nov}
(32) 
_{Dec}
(72) 
2007 
_{Jan}
(316) 
_{Feb}
(305) 
_{Mar}
(318) 
_{Apr}
(54) 
_{May}
(194) 
_{Jun}
(173) 
_{Jul}
(282) 
_{Aug}
(91) 
_{Sep}
(227) 
_{Oct}
(365) 
_{Nov}
(168) 
_{Dec}
(18) 
2008 
_{Jan}
(71) 
_{Feb}
(111) 
_{Mar}
(155) 
_{Apr}
(173) 
_{May}
(70) 
_{Jun}
(67) 
_{Jul}
(55) 
_{Aug}
(83) 
_{Sep}
(32) 
_{Oct}
(68) 
_{Nov}
(80) 
_{Dec}
(29) 
2009 
_{Jan}
(46) 
_{Feb}
(18) 
_{Mar}
(95) 
_{Apr}
(76) 
_{May}
(140) 
_{Jun}
(98) 
_{Jul}
(84) 
_{Aug}
(123) 
_{Sep}
(94) 
_{Oct}
(131) 
_{Nov}
(142) 
_{Dec}
(125) 
2010 
_{Jan}
(128) 
_{Feb}
(158) 
_{Mar}
(172) 
_{Apr}
(134) 
_{May}
(94) 
_{Jun}
(84) 
_{Jul}
(32) 
_{Aug}
(127) 
_{Sep}
(167) 
_{Oct}
(109) 
_{Nov}
(69) 
_{Dec}
(78) 
2011 
_{Jan}
(39) 
_{Feb}
(58) 
_{Mar}
(52) 
_{Apr}
(47) 
_{May}
(56) 
_{Jun}
(76) 
_{Jul}
(55) 
_{Aug}
(54) 
_{Sep}
(165) 
_{Oct}
(255) 
_{Nov}
(328) 
_{Dec}
(263) 
2012 
_{Jan}
(82) 
_{Feb}
(147) 
_{Mar}
(400) 
_{Apr}
(216) 
_{May}
(209) 
_{Jun}
(160) 
_{Jul}
(86) 
_{Aug}
(141) 
_{Sep}
(156) 
_{Oct}
(6) 
_{Nov}

_{Dec}

S  M  T  W  T  F  S 





1

2

3

4

5
(17) 
6

7
(4) 
8

9

10

11

12
(5) 
13

14
(1) 
15
(1) 
16

17

18

19
(3) 
20

21
(1) 
22

23

24
(1) 
25
(5) 
26
(3) 
27
(10) 
28
(7) 
29
(4) 
30
(10) 
31
(13) 
From: <adb014@pr...>  20040126 14:34:54

Update of /cvsroot/octave/octaveforge/extra/linearalgebra In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv6939 Modified Files: chol.cc Log Message: Initialization bug in chol.cc Index: chol.cc =================================================================== RCS file: /cvsroot/octave/octaveforge/extra/linearalgebra/chol.cc,v retrieving revision 1.3 retrieving revision 1.4 diff u d r1.3 r1.4  chol.cc 12 Dec 2003 22:05:38 0000 1.3 +++ chol.cc 26 Jan 2004 14:34:02 0000 1.4 @@ 32,6 +32,7 @@ #include "utils.h" extern void install_tri_ops(void); +static bool type_loaded = false; DEFUN_DLD (chol, args, nargout, "* texinfo *\n\ @@ 84,10 +85,10 @@ CHOL fact (m, info); if (nargout == 2  info == 0) {  static bool type_loaded = false; if (! type_loaded) { octave_tri::register_type (); install_tri_ops(); + type_loaded = true; } retval(1) = static_cast<double> (info); @@ 108,6 +109,12 @@ ComplexCHOL fact (m, info); if (nargout == 2  info == 0) { + if (! type_loaded) { + octave_tri::register_type (); + install_tri_ops(); + type_loaded = true; + } + retval(1) = static_cast<double> (info); retval(0) = fact.chol_matrix (); } 
From: <mcreel@pr...>  20040126 10:29:57

Update of /cvsroot/octave/octaveforge/main/optim/Optimize In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv14217 Added Files: BFGSMin.m Battery.m BisectionStep.m ExampleBFGSMin.m ExampleNumGradient.m FiniteDifference.m NewtonStep.m NumGradient.m NumHessian.m QuadInterpStep.m Log Message:  NEW FILE: BFGSMin.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA #============================ BFGSMin.m ===================================== # Minimize a function of the form [value, gradient] = f(args), # where args is a cell array. # # Minimization is with respect to the FIRST element of args. # If the gradient is not available, the function should return "na" or some other # string. # # * numeric or analytic gradient # * default strict convergence criteria # * can control verbosity and convergence criteria # * attempts to be robust # # Brief summary of syntax follows, for a more # extensive example, see the file ExampleBFGSMin.m # # calling syntax: # # [theta, obj_value, iters, convergence] = BFGSMin(func, args, control) # # or # # [theta, obj_value, iters, convergence] = BFGSMin(func, args) # # input arguments: # func  (string) the function to minimize # args  arguments, in a cell array. # control  optional 3x1 vector # * 1st elem is max iters (scalar > 0, or 1 for infinity) # * 2nd elem is verbosity control # (0 = no results printed) # (1 = intermediate results) # (2 = only last iteration results) # * 3rd arg specifies convergence criterion # 1 (default) = function, gradient, and parameter change # are all tested # 0 = only function conv tested # # Outputs: theta  the minimizer # obj_value  the minimized funtion value # iters  number of iterations used # convergence (1 = success, 0 = failure) function [theta, obj_value, iters, convergence] = BFGSMin(func, args, control) # convert to cell array if, needed if !iscell(args) args = {args}; endif theta = args{1}; # Set defaults # default strong criterion criterion = 1; # tolerances func_tol = 10*sqrt(eps); param_tol = 1e5; gradient_tol = 1e4; # max iters, and screen display max_iters = inf; convergence = 1; # if this doesn't change, it means that maxiters were exceeded verbosity = 0; # Control verbosity, max iterations, and arg wrt which we minimize (optional) if nargin == 3 max_iters = control(1,:); if max_iters == 1, max_iters = inf; endif verbosity = control(2,:); criterion = control(3,:); endif # initialize things thetain = theta; H = eye (prod (sz = size (theta))); # Initial gradient and obj_value [last_obj_value, g] = feval(func, args); # use numeric derivatives if analytic aren't given numeric_gradient = 0; if isstr(g) numeric_gradient = 1; # don't repeat this test in future g = NumGradient(func, args); endif g = g(:); # make sure it's a column vector if sum(isnan(g)) > 0 warning("BFGS: Initial gradient could not be calculated: exiting"); convergence = 2; break; endif iters = 0; while iters < max_iters # succesful termination checks are inside loop iters += 1; theta = args{1}; d = H*g; # Regular step [stepsize, obj_value] = NewtonStep(func, d, args); # Supposing regular step fails ... if isnan(stepsize) # try steepest descent on first failure of linesearch d = g; warning("BFGS: Stepsize failure in BFGS direction, trying steepest descent direction"); [stepsize, obj_value] = NewtonStep(func, d, args); if isnan(stepsize) warning("BFGS: failure to find direction of improvement: exiting"); theta = thetain; convergence = 2; break; endif endif p = stepsize*d; # check normal convergence: all 3 must be satisfied conv1 = abs(obj_value  last_obj_value)/max(1,abs(last_obj_value)) < func_tol; conv2 = (norm (p) / max (1,norm (theta(:)))) < param_tol; conv3 = (norm(g) <= gradient_tol); # Want intermediate results? if verbosity == 1 printf("\nIteration %d\n",iters); printf("Stepsize %8.7f\n", stepsize); printf("Objective function value %16.10f\n", last_obj_value); printf("Function conv %d Param conv %d Gradient conv %d\n", conv1, conv2, conv3); printf(" params gradient change\n"); for j = 1:rows(theta) printf("%8.4f %8.4f %8.4f\n",theta(j,:),g(j,:),p(j,:)); endfor printf("\n"); endif if criterion == 1 if (conv1 && conv2 && conv3) convergence = 1; break; endif elseif conv1 convergence = 1; break; endif; last_obj_value = obj_value; thetanew = theta + p; argsnew = args; args{1} = thetanew; argsnew{1} = thetanew; # get gradient at new parameter value if numeric_gradient g_new = NumGradient(func, argsnew); else [dummy, g_new] = feval(func, argsnew); endif g_new = g_new(:); # Update the quasiHessian # Note: if the new gradient fails and the Hessian is identity matrix # we will break out with failure, since we've already tried Hessian # reset. # Perform normal iteration if gradient succeeds if sum(isnan(g_new)) == 0 q = g_newg; g = g_new; denominator = q'*p; if denominator < eps # reset Hessian if necessary H = eye(rows(theta)); else H += (1+(q'*H*q)/denominator) * (p*p')/denominator  (p*q'*H+H*q*p')/denominator; endif # otherwise reset Hessian and try with last good gradient # if we already reset Hessian then we're out of luck elseif H == eye (prod (sz = size (theta))) convergence = 2; theta = thetain; break; # Here's the Hessian reset else H = eye (prod (sz = size (theta))); endif endwhile # Want last iteration results? if verbosity == 2 printf("\nIteration %d\n",iters); printf("Stepsize %8.7f\n", stepsize); printf("Objective function value %16.10f\n", last_obj_value); printf("Function conv %d Param conv %d Gradient conv %d\n", conv1, conv2, conv3); printf(" params gradient change\n"); for j = 1:rows(theta) printf("%8.4f %8.4f %8.4f\n",theta(j,:),g(j,:),p(j,:)); endfor printf("\n"); endif endfunction #============================ end BFGSMin =====================================  NEW FILE: Battery.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # func: function to mimimize # args: args of function  first is arg we min w.r.t. # startvals: kxp matrix of values to try for sure (don't include all zeros, that's automatic) # max iters per start value # number of additional random start values to try function theta = Battery(func, args, startvals, maxiters) # setup [k,trials] = size(startvals); bestobj = inf; besttheta = zeros(k,1); bfgscontrol = [maxiters;0;1;1]; # now try the supplied start values, and optionally the random start values for i = 1:trials args{1} = startvals(:,i); [theta, obj_value, iters, convergence] = BFGSMin (func, args, bfgscontrol); if obj_value < bestobj besttheta = theta; bestobj = obj_value; endif endfor theta = besttheta; endfunction  NEW FILE: BisectionStep.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA #============================ BisectionStep ===================================== # # this is for use by BFGSMin # # Uses bisection to find a stepsize that leads to a decrease, then # continues until no further improvement # Michael Creel michael.creel@... # 13/01/2004 # # usage: # [a, obj_value] = BisectionStep(f, dx, args) # inputs: # f: the objective function # dx: the direction # args: the arguments of the function, in a cell array. # The first argument is the one w.r.t. # which we are minimizing. function [a, obj] = BisectionStep(f, dx, args) if !iscell(args) args = {args}; endif x = args{1}; args_in = args; obj_0 = feval(f, args); a = 1; # this first loop goes until an improvement is found while a > 2*eps # limit iterations args{1} = x + a*dx; obj = feval(f, args); if (obj > obj_0)  isnan(obj) # reduce stepsize if worse, or if function can't be evaluated a = 0.5 * a; else obj_0 = obj; break; endif endwhile # now keep going until we no longer improve, or reach max trials while a > 2*eps a = 0.5*a; args{1} = x + a*dx; obj = feval(f, args); # if improved, record new best and try another step if ((obj < obj_0) & !isnan(obj)) obj_0 = obj; else a = a / 0.5; # put it back to best found break; endif; endwhile obj = obj_0; endfunction #============================ end BisectionStep =====================================  NEW FILE: ExampleBFGSMin.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # This shows how to call BFGSMin.m # This minimizes the Rosenbrock function, with minimizer translated # to "location". The "location" translation illustrates how # additional arguments (those w.r.t. which we are NOT minimizing) # may be used in definition of the objective function. # The argument w.r.t. which we minimize must be the FIRST argument # in the cell array that is the argument to BFGSMin. # Function value and gradient vector of the rosenbrock function # The minimizer is at the vector (1,1,..,1), # and the minimized value is 0. function [obj_value, gradient] = rosenbrock(x); dimension = length(x); obj_value = sum(100*(x(2:dimension)x(1:dimension1).^2).^2 + (1x(1:dimension1)).^2); if nargout > 1 gradient = zeros(dimension, 1); gradient(1:dimension1) =  400*x(1:dimension1).*(x(2:dimension)x(1:dimension1).^2)  2*(1x(1:dimension1)); gradient(2:dimension) = gradient(2:dimension) + 200*(x(2:dimension)x(1:dimension1).^2); endif endfunction # The example objective functions # example obj. fn.  this shows how to use analytic gradient function [obj_value, grad] = objective(args) theta = args{1}; location = args{2}; x = theta  location + ones(rows(theta),1); # move minimizer to "location" [obj_value, grad] = rosenbrock(x); endfunction # example obj. fn.  this shows how to use numerical grafient function [obj_value, grad] = objective2(args) theta = args{1}; location = args{2}; x = theta  location + ones(rows(theta),1); # move minimizer to "location" obj_value = rosenbrock(x); grad = "na"; endfunction tic(); # control options and initial value control = [1000;2;1]; # max 1000 iterations; only report results of last iteration; strong convergence required dim = 50; # dimension of Rosenbrock function theta = randn(dim+1,1); # starting values location = 5*(0:dim)/dim; location = location'; args = {theta, location}; # BFGSMin requires arguments to be in a cell array # do the minimization printf("If this was successful, the minimizer should be\n"); printf("a vector of even steps from 0 to 5\n\n"); theta printf("ANALYTIC GRADIENT\n"); [theta, obj_value, iterations, convergence] = BFGSMin("objective", args, control); t = toc(); tic(); printf("Elapsed time = %f\n",t); printf("NUMERIC GRADIENT\n"); [theta, obj_value, iterations, convergence] = BFGSMin("objective2", args, control); t = toc(); printf("Elapsed time = %f\n",t);  NEW FILE: ExampleNumGradient.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Shows how to call numeric derivatives, and verifies with analytic # The Rosenbrock function  used to define objective functions # Function value and gradient vector of the rosenbrock function # The minimizer is x = [1; 1;...;1], and the minimized value is 0. function [obj_value, gradient] = rosenbrock(x); dimension = length(x); obj_value = sum(100*(x(2:dimension)x(1:dimension1).^2).^2 + (1x(1:dimension1)).^2); if nargout > 1 gradient = zeros(dimension, 1); gradient(1:dimension1) =  400*x(1:dimension1).*(x(2:dimension)x(1:dimension1).^2)  2*(1x(1:dimension1)); gradient(2:dimension) = gradient(2:dimension) + 200*(x(2:dimension)x(1:dimension1).^2); endif endfunction # The example objective functions # example obj. fn.  this shows how to use analytic gradient function [obj_value, grad] = objective(args) theta = args{1}; [obj_value, grad] = rosenbrock(theta); endfunction # example obj. fn.  this shows how to use numerical grafient function [obj_value, grad] = objective2(args) theta = args{1}; obj_value = rosenbrock(theta); grad = "na"; endfunction # Here's how to get the numeric gradient args = {randn(10,1)}; ngradient = NumGradient("objective", args); # Analytic gradient, to verify [o, agradient] = objective(args); ngradient = ngradient'; printf("\nCheck NumGradient\n"); printf("\nDerivatives of the Rosenbrock function, random start values\n\n"); printf(" Numeric Analytic Difference\n"); results = [ngradient agradient ngradient  agradient]; disp(results);  NEW FILE: FiniteDifference.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA #========================= FiniteDifference ========================== # finite differences for numeric differentiation # the formulae here are based on those in Ox 3.20 (Doornik) # which references Rice function d = FiniteDifference(x, order) SQRT_EPS = sqrt(eps); # eps is machine precision DIFF_EPS = exp(log(eps)/2); DIFF_EPS1 = exp(log(eps)/3); DIFF_EPS2 = exp(log(eps)/4); if (order == 0) diff = DIFF_EPS; elseif (order == 1) diff = DIFF_EPS1; else diff = DIFF_EPS2; endif d = max( (abs(x) + SQRT_EPS) * SQRT_EPS, diff); endfunction #========================= END FiniteDifference ==========================  NEW FILE: NewtonStep.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA #============================ NewtonStep ===================================== # # this is for use by BFGSMin # # Uses a Newton interation to attempt to find a good stepsize # falls back to BisectionStep if no improvement found # Michael Creel michael.creel@... # 13/01/2004 # # usage: # [a, obj_value] = NewtonStep(f, dx, args) # inputs: # f: the objective function # dx: the direction # args: the arguments of the function, in a cell array. # The first argument is the one w.r.t. # which we are minimizing. function [a, obj] = NewtonStep(f, dx, args) if !iscell(args) args = {args}; endif x = args{1}; args_in = args; gradient = 1; evaluations = 0; obj_0 = obj = feval(f, args); delta = 0.001; # experimentation show that this is a good choice x_right = x + delta*dx; x_left = x  delta*dx; args{1} = x_right; obj_right = feval(f, args); args{1} = x_left; obj_left = feval(f, args); gradient = (obj_right  obj_left) / (2*delta); # take central difference hessian = (obj_right  2*obj + obj_left) / (delta^2); hessian = abs(hessian); # ensures we're going in a decreasing direction if hessian <= eps, hessian = 1; endif # avoid div by zero a =  gradient/hessian; # hessian inverse gradient: the Newton step # check that this is improvement args{1} = x+a*dx; obj = feval(f, args); # if not, fall back to bisection if ((obj > obj_0)  isnan(obj)) [a, obj] = BisectionStep(f, dx, args_in); endif endfunction #============================ end NewtonStep =====================================  NEW FILE: NumGradient.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA #============================= NumGradient ============================= # Central difference gradient of a function of the form # f(args), where args is a cell array. # # The gradient is respect to the FIRST element of args. # # * Allows diff. of vectorvalued function # * Uses systematic finite difference function derivative = NumGradient(f, args) if !iscell(args) args = {args}; endif parameter = args{1}; k = rows(parameter); obj_value = feval(f, args); n = rows(obj_value); derivative = zeros(n, k); for i = 1:k # get 1st derivative by central difference p = parameter(i); delta = FiniteDifference(p,1); # right side parameter(i) = d = p + delta; delta_right = d  p; args{1} = parameter; obj_right = feval(f, args); # left size parameter(i) = d = p  delta; delta_left = p  d; args{1} = parameter; obj_left = feval(f, args); parameter(i) = p; # restore original parameter derivative(:,i) = (obj_right  obj_left) / (delta_right + delta_left); # take central difference endfor endfunction #=========================== END NumGradient ===========================  NEW FILE: NumHessian.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA #============================= NumHessian ============================= # Inspired by Ox 3.20 (Doornik) function derivative = NumHessian(f, args) if !iscell(args) args = {args}; endif parameter = args{1}; k = rows(parameter); obj_value = feval(f, args); derivative = zeros(k, k); for i = 1:k # approximate 2nd deriv. by central difference pi = parameter(i); hi = FiniteDifference(pi, 2); for j = 1:(i1) # offdiagonal elements pj = parameter(j); hj = FiniteDifference(pj,2); parameter(i) = di = pi + hi; parameter(j) = dj = pj + hj; # +1 +1 hia = di  pi; hja = dj  pj; args{1} = parameter; fpp = feval(f, args); parameter(i) = di = pi  hi; parameter(j) = dj = pj  hj; # 1 1 hia = hia + pi  di; hja = hja + pj  dj; args{1} = parameter; fmm = feval(f, args); parameter(i) = pi + hi; parameter(j) = pj  hj; # +1 1 args{1} = parameter; fpm = feval(f, args); parameter(i) = pi  hi; parameter(j) = pj + hj; # 1 +1 args{1} = parameter; fmp = feval(f, args); derivative(j,i) = ((fpp  fpm) + (fmm  fmp)) / (hia * hja); derivative(i,j) = derivative(j,i); parameter(j) = pj; endfor # diagonal elements parameter(i) = di = pi + 2 * hi; # +1 +1 args{1} = parameter; fpp = feval(f, args); hia = (di  pi) / 2; parameter(i) = di = pi  2 * hi; # 1 1 args{1} = parameter; fmm = feval(f, args); hia = hia + (pi  di) / 2; derivative(i,i) = ((fpp  obj_value) + (fmm  obj_value)) / (hia * hia); parameter(i) = pi; endfor endfunction #============================ END NumHessian ==========================  NEW FILE: QuadInterpStep.m  # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA #============================ QuadInterpStep ===================================== # # this is for use by BFGSMin, though by default NewtonStep is used # # Uses quadratic interpolation to attempt to find a good stepsize # falls back to BisectionStep if no improvement found # Michael Creel michael.creel@... # 13/01/2004 # # usage: # [a, obj_value] = QuadInterpStep(f, dx, args) # inputs: # f: the objective function # dx: the direction # args: the arguments of the function, in a cell array. # The first argument is the one w.r.t. # which we are minimizing. function [a, obj] = QuadInterpStep(f, dx, args) if !iscell(args) args = {args}; endif x = args{1}; args_in = args; evaluations = 0; obj_0 = feval(f, args); left = 0.1; right = 3; center = 1; args{1} = x + left*dx; obj_left = feval(f, args); args{1} = x + center*dx; obj_center = feval(f, args); args{1} = x + right*dx; obj_right = feval(f, args); # Best is on L extreme if (obj_left < obj_center) & (obj_left < obj_right) obj = obj_left; a = left; # Best is on R extreme elseif (obj_right < obj_center) & (obj_right < obj_left) obj = obj_right; a = right; # Best is in middle  do interp else a = obj_left*(center^2  right^2) + obj_center*(right^2  left^2) + obj_right*(left^2  center^2); a = 0.5 * a / (obj_left*(center  right) + obj_center*(right  left) + obj_right*(left  center)); args{1} = x + a*dx; obj = feval(f, args); endif # fall back to bisection if this is not improvement or there is some sort of crash if ((obj > obj_0)  (!isreal(obj))  (!isreal(a))) [a, obj] = BisectionStep(f, dx, args_in); endif endfunction #============================ end QuadInterpStep ===================================== 
From: <mcreel@pr...>  20040126 10:25:02

Update of /cvsroot/octave/octaveforge/main/optim/Optimize In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv13344/optim/Optimize Log Message: Directory /cvsroot/octave/octaveforge/main/optim/Optimize added to the repository 