From: XIN LI <xl...@jh...> - 2007-04-30 21:17:13
|
Hello,I am using vxl-1.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 |
From: Ian S. <ian...@st...> - 2007-05-01 08:15:32
|
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 vxl-1.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 > |
From: Peter V. <pet...@ya...> - 2007-05-01 09:47:10
|
Ian Scott wrote: > There are plenty of meanings of "the Jacobian of a matrix" The Jacobian of a (coordinate) transformation is well-defined. And a linear transformation can be represented by a transformation matrix. So most probably that's what is meant by "the Jacobian of a matrix"? (See, e.g., http://math.etsu.edu/MultiCalc/Chap3/Chap3-5/index.htm) The Jacobian is then itself a transformation matrix representing the (linear) transformation between derivatives (or tangent vectors) in the two coordinate frames. -- Peter. __________________________________________________________ Hitta din nästa resa på Yahoo! Shopping. Jämför pris på flygbiljetter och hotellrum här: http://shopping.yahoo.se/b/a/c_169901_resor_biljetter.html |
From: Peter V. <pet...@ya...> - 2007-05-01 10:28:29
|
A logical place to implement the Jacobian of a transformation matrix would be in the class vcsl_matrix. I personally don't think core/vnl would be a good place for this since "vnl_matrix" is not necessarily a transformation matrix, and Jacobians clearly have transformation semantics. Implementations for the Jacobian of several transformations are already in contrib/rpl/rgrl/; see especially the functions proj_jac_wrt_loc() and jacobian_wrt_loc(). Comments? Suggestions? Alternatives? -- Peter. __________________________________________________________ Hitta din nästa resa på Yahoo! Shopping. Jämför pris på flygbiljetter och hotellrum här: http://shopping.yahoo.se/b/a/c_169901_resor_biljetter.html |
From: Ian S. <ian...@st...> - 2007-05-01 15:58:32
|
This is a simple forward-differences Jacobian estimator. I've modified it a little to reduce the required context, so it hasn't been directly tested. You can get better estimates using central or higher-order differences. 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); rf_inst.set_x(x); vnl_vector<double> r=rf_inst.calc_residual(); 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...@st...> > Date: Tuesday, May 1, 2007 4:15 am > Subject: Re: [Vxl-users] question about jacobian > To: XIN LI <xl...@jh...> > Cc: VXL users <vxl...@li...> > > >> 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 vxl-1.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 >> > |