00001 #ifndef vnl_lsqr_h_
00002 #define vnl_lsqr_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00035
00036 int minimize(vnl_vector<double>& x);
00037
00038 int get_number_of_iterations() const { return num_iter_; }
00039
00040
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_