help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom jacobian (dfdp) in nonlin_curvefit - calling parameters?


From: Olaf Till
Subject: Re: Custom jacobian (dfdp) in nonlin_curvefit - calling parameters?
Date: Mon, 18 Nov 2019 18:39:54 +0100
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, Nov 18, 2019 at 03:55:41PM +0100, Pavel Hofman wrote:
> Hi Olaf,
> 
> > > f = @(p, x) ... where x is one row of indeps, and f returns two rows, each
> > > row for one equation (each equation uses all p elements). This code works
> > > OK.
> > > 
> > > If I wanted to use explicit jacobian to improve precision and calculation
> > > stability, please how should I handle the two equations in f and dfdp?
> > 
> > Sorry, please forget what I said about the reshaping of 'x', I was
> > confused... I probably shouldn't try to answer help requests while I'm
> > working on something different. And I probably don't understand what
> > you mean with 'the 2D case'.
> > 
> > The Jacobian should just compute one row of partial derivatives for
> > each element of the result of 'f'.
> 
> Thanks but my f returns a 2D matrix (a row for each equation, a column for
> each element of the indeps vector x). Should the dfdp return a 3D matrix?

From optim_doc, for nonlin_residmin:

'dfdp'
     Function computing the Jacobian of the residuals with respect to
     the parameters, assuming residuals are reshaped to a column vector.

So for calculating the Jacobian, assume that the array returned by 'f'
is reshaped to a column vector (as with array(:)). So the Jacobian is
2D.

(The differences between nonlin_curvefit and nonlin_residmin do not
affect this.)

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]