From: Ian Scott <ian.m.scott@st...>  20070501 16:04:42

Sorry, I forgot to fix some stuff that depends on my libraries. This version looks better. I should also point out that there are probably more efficient implementations. Where I have used this code, the runtime cost of f() dominates the problem. Ian. vnl_matrix<double> forward_differences( my_functor_t& f, // the function vnl_vector<double> x_0, // the central point const vnl_vector<double> &scale) // the measurement scale. { vnl_vector<double> r_0 = f(x_0); unsigned nr = r_0.size(); unsigned nx = x_0.size(); vnl_matrix<double> jacobian(nr, nx); for (unsigned i=0; i<nx; ++i) { vnl_vector<double> x=x_0; x(i) += scale(i); vnl_vector<double> r=f(x); vnl_vector<double> dr = r  r_0; dr /= scale(i); jacobian.set_column(i, dr); } return jacobian; } XIN LI wrote: > Hello, > > Sorry. I should say that I would like to get the jacobian matrix of a vector value function. Just as the traditional definition of Jacobian. > > Could you please tell me how to implement this funcion using VXL library? > > Thank you very much! > > Xin > > > >  Original Message  > From: Ian Scott <ian.m.scott@...> > Date: Tuesday, May 1, 2007 4:15 am > Subject: Re: [Vxlusers] question about jacobian > To: XIN LI <xli16@...> > Cc: VXL users <vxlusers@...> > > >> Li, >> >> This probably isn't what you want to hear but  are you sure you >> understand what you are asking for? >> >> The Jacobian is traditionally defined on a vector function Y=F(X), >> where >> Y in a m element vector and X is an n element vector. >> >> The Jacobian is the matrix of first derivatives of Y, w.r.t. to each >> >> element in X, >> >> dY_i >> J_ij = ____ >> dX_J >> >> (or possibly the transpose  I can't remember) >> >> You can talk about an analogous Jacobian of a matrix, but usually >> after >> defining a flattening of the matrix into a vector, and then defining >> the >> variables against which you want to calculate the derivative. >> >> The are plenty of other meanings of "the Jacobian of a matrix", e.g. >> >> assuming the matrix is a Hessian of F, its square is a rough >> approximation to the Jacobian. >> >> The code to perform these calculations is available in VXL, but not >> as a >> simple class, since the implementation depends on what exactly you >> mean >> by "Jacobian of a matrix" >> >> Ian. >> >> XIN LI wrote: >> > Hello, >> > >> > I am using vxl1.8.0. I would like to get the jacobian of a matrix. >> >> > Could you please tell me which class I should use to get the >> jacobian >> > matrix? >> > >> > Thanks! >> > >> > Xin >> >  This SF.net email is sponsored by DB2 Express Download DB2 Express C  the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Vxlusers mailing list Vxlusers@... https://lists.sourceforge.net/lists/listinfo/vxlusers 