]> Creatis software - CreaPhase.git/blob - octave_packages/optim-1.2.0/dfpdp.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / optim-1.2.0 / dfpdp.m
1 %% Copyright (C) 2010, 2011 Olaf Till <olaf.till@uni-jena.de>
2 %%
3 %% This program is free software; you can redistribute it and/or modify it under
4 %% the terms of the GNU General Public License as published by the Free Software
5 %% Foundation; either version 3 of the License, or (at your option) any later
6 %% version.
7 %%
8 %% This program is distributed in the hope that it will be useful, but WITHOUT
9 %% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 %% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 %% details.
12 %%
13 %% You should have received a copy of the GNU General Public License along with
14 %% this program; if not, see <http://www.gnu.org/licenses/>.
15
16 %% function jac = dfpdp (p, func[, hook])
17 %%
18 %% Returns Jacobian of func (p) with respect to p with finite
19 %% differencing. The optional argument hook is a structure which can
20 %% contain the following fields at the moment:
21 %%
22 %% hook.f: value of func(p) for p as given in the arguments
23 %%
24 %% hook.diffp: positive vector of fractional steps from given p in
25 %% finite differencing (actual steps may be smaller if bounds are
26 %% given). The default is .001 * ones (size (p)).
27 %%
28 %% hook.diff_onesided: logical vector, indexing elements of p for
29 %% which only one-sided differences should be computed (faster); even
30 %% if not one-sided, differences might not be exactly central if
31 %% bounds are given. The default is false (size (p)).
32 %%
33 %% hook.fixed: logical vector, indexing elements of p for which zero
34 %% should be returned instead of the guessed partial derivatives
35 %% (useful in optimization if some parameters are not optimized, but
36 %% are 'fixed').
37 %%
38 %% hook.lbound, hook.ubound: vectors of lower and upper parameter
39 %% bounds (or -Inf or +Inf, respectively) to be respected in finite
40 %% differencing. The consistency of bounds is not checked.
41
42 function ret = dfpdp (varargin)
43
44   %% This is an interface to __dfdp__.m.
45
46   if (ischar (varargin{2}))
47     varargin{2} = str2func (varargin{2});
48   end
49
50   ret = __dfdp__ (varargin{:});