Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_lsqr.h

Go to the documentation of this file.
00001 #ifndef vnl_lsqr_h_
00002 #define vnl_lsqr_h_
00003 //:
00004 // \file
00005 // \brief Linear least squares
00006 // \author David Capel, capes@robots, July 2000
00007 //    vnl_lsqr implements an algorithm for large, sparse linear systems and
00008 //    sparse, linear least squares. It is a wrapper for the LSQR algorithm
00009 //    of Paige and Saunders (ACM TOMS 583). The sparse system is encapsulated
00010 //    by a vnl_linear_system.
00011 //
00012 //     
00013 
00014 //   Modifications
00015 //     000705 capes@robots initial version.
00016 //     4/4/01 LSB (Manchester) Documentation tidied
00017 //
00018 //-----------------------------------------------------------------------------
00019 
00020 #include <vnl/vnl_vector.h>
00021 #include <vnl/vnl_matrix.h>
00022 #include <vnl/vnl_linear_system.h>
00023 
00024 
00025 class vnl_lsqr {
00026 public:
00027   vnl_lsqr(vnl_linear_system& ls) :
00028     ls_(&ls), max_iter_(ls.get_number_of_unknowns()) {}
00029 
00030   ~vnl_lsqr();
00031 
00032   void set_max_iterations(int max_iter) { max_iter_ = max_iter; }
00033 
00034   //: Perform the minimization starting from x=0 and putting the result into x.
00035   // Return code may be translated with translate_return_code().
00036   int minimize(vnl_vector<double>& x);
00037 
00038   int get_number_of_iterations() const { return num_iter_; }
00039 
00040   //: Pontificate about the outcome of the last minimization.
00041   void diagnose_outcome(vcl_ostream& os) const;
00042 
00043   static void translate_return_code(vcl_ostream& os, int return_code);
00044 
00045 protected:
00046   vnl_linear_system* ls_;
00047   int max_iter_;
00048   int num_iter_;
00049   double resid_norm_estimate_;
00050   double result_norm_estimate_;
00051   double A_condition_estimate_;
00052   double result_norm_;
00053   int return_code_;
00054 
00055   static int aprod_(int* mode, int* m, int* n, double* x, 
00056     double* y, int* leniw, int* lenrw, int* iw, double* rw );
00057 
00058   friend class vnl_lsqr_Activate;
00059 
00060 };
00061 
00062 #endif // vnl_lsqr_h_

Generated at Wed Mar 12 01:13:15 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000