[Vxl-users] problem with vnl_conjugate_gradient From: YAN Zhennan - 2006-11-21 06:17:02 Attachments: Message as HTML ```Hi, I'm trying to use vnl_conjugate_gradient to solve my system of linear equations (Ax=b), but I have no idea how to construct a vnl_cost_function object which represents my system of linear equations, or how to represent the matrix A and vector b. Thanks, nan ```

 [Vxl-users] problem with vnl_conjugate_gradient From: YAN Zhennan - 2006-11-21 06:17:02 Attachments: Message as HTML ```Hi, I'm trying to use vnl_conjugate_gradient to solve my system of linear equations (Ax=b), but I have no idea how to construct a vnl_cost_function object which represents my system of linear equations, or how to represent the matrix A and vector b. Thanks, nan ```
 Re: [Vxl-users] problem with vnl_conjugate_gradient From: Peter Vanroose - 2006-11-21 07:29:14 ```> I'm trying to use vnl_conjugate_gradient to solve my system of linear > equations (Ax=b), but I have no idea how to construct a > vnl_cost_function object which represents my system of linear equations, or > how to represent the matrix A and vector b. Have a look in core/vnl/algo/tests/test_algo.cxx and more specifically in test_powell() around line 95. First you need to define a class (F_test_powell in the example) where the cost function calculation is done (in the member called f -- required name). See lines 85-91. Store your matrix A and vector b as data members in that class, Then just use that class as done on line 97: vnl_conjugate_gradient cg(class_instance); cg.minimize(x); where x is an initial guess (vector). -- Peter. _________________________________________________________ Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda kalender. Dessutom 250 MB gratis, virusscanning och antispam. Få den på: http://se.mail.yahoo.com ```