[Insight-users] Ax=b system with CGS

Miller, James V (GE, Research) millerjv at crd.ge.com
Wed Feb 1 17:16:05 EST 2006


It looks like vnl_lsqr is a conjugate-gradient method for sparse matrices.
Here is a guess on how to use it.... 

// construct the problem
vnl_sparse_matrix<double> A;
vnl_vector<double> b;

// configure A and b (set the elements of A and b)

// instantiate the linear system object
vnl_sparse_matrix_linear_sytem<double> problem(A, b);

// instantiate the solver
vnl_lsqr solver(problem);

// call minimize on the solver
int returnCode;
vnl_vector<double> x;  // may need to size this appropriately and initialize?
returnCode = solver.minimize(x); 




-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Ertan Cetingul
Sent: Wednesday, February 01, 2006 2:08 PM
To: insight-users at itk.org
Subject: [Insight-users] Ax=b system with CGS


Hi all,

I am trying to solve a system of linear equations Ax=b
using Conjugate Gradient Squared (CGS) method. A is a
sparse matrix by the way. I am using .NET and want to
imitate the MATLAB function "cgs.m" for that purpose.
However I could not find anything apart from vnl_lsqr
and vnl_conjugate_gradient, which takes a
vnl_cost_function F as input. I could not figure out
how to use these.  

I will appreciate any comment.

Best Regards,

Ertan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list