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

vnl_cholesky.h

Go to the documentation of this file.
00001 #ifndef vnl_cholesky_h_
00002 #define vnl_cholesky_h_
00003 //:
00004 //  \file
00005 //  \brief vnl_cholesky - Decomposition of symmetric matrix
00006 //  \author Andrew W. Fitzgibbon, Oxford RRG, 08 Dec 96
00007 //
00008 //  Modifications
00009 //  Peter Vanroose, Leuven, Apr 1998: added L() (return decomposition matrix)
00010 //  dac (Manchester) 26/03/2001: tidied up documentation
00011 //
00012 
00013 #include <vnl/vnl_vector.h>
00014 #include <vnl/vnl_matrix.h>
00015 
00016 //: vnl_cholesky - Decomposition of symmetric matrix
00017 //  A class to hold the Cholesky decomposition of a symmetric matrix and
00018 //  use that to solve linear systems, compute determinants and inverses.
00019 //  The cholesky decomposition decomposes symmetric A = L*L.transpose()
00020 //  where L is lower triangular 
00021 
00022 
00023 class vnl_cholesky {
00024 public:
00025   //: Modes of computation.  See constructor for details.
00026   enum Operation {
00027     quiet,
00028     verbose,
00029     estimate_condition
00030   };
00031   
00032   //: Make cholesky decomposition of M optionally computing
00033   // the reciprocal condition number.
00034   vnl_cholesky(vnl_matrix<double> const& M, Operation mode = verbose);
00035  ~vnl_cholesky() {}
00036 
00037   //: Solve LS problem M x = b
00038   vnl_vector<double> solve(vnl_vector<double> const& b) const;
00039 
00040   //: Solve LS problem M x = b
00041   void solve(vnl_vector<double> const& b, vnl_vector<double>* x) const;
00042   
00043   //: Compute determinant
00044   double determinant() const;
00045   
00046   //: Compute inverse.  Not efficient.
00047   vnl_matrix<double> inverse() const;
00048 
00049   //: Return lower-triangular factor.
00050   vnl_matrix<double> lower_triangle() const;
00051 
00052   //: Return upper-triangular factor.
00053   vnl_matrix<double> upper_triangle() const;
00054 
00055   //: return the decomposition matrix
00056   vnl_matrix<double> const& L_badly_named_method() { return A_; }
00057 
00058   //: A Success/failure flag
00059   int rank_deficiency() const { return num_dims_rank_def_; }
00060   
00061   //: Return reciprocal condition number.  Not calculated unless Operaton mode
00062   // at construction was estimate_condition.
00063   double rcond() const { return rcond_; }
00064 
00065   //: Return computed nullvector. Not calculated unless Operaton mode
00066   // at construction was estimate_condition.
00067   vnl_vector<double>      & nullvector()       { return nullvector_; }
00068   vnl_vector<double> const& nullvector() const { return nullvector_; }
00069 
00070   // Data Control--------------------------------------------------------------
00071 
00072 protected:
00073   // Data Members--------------------------------------------------------------
00074   vnl_matrix<double> A_;
00075   double rcond_;
00076   int num_dims_rank_def_;
00077   vnl_vector<double> nullvector_;
00078   
00079 private:
00080   
00081   //: Copy constructor - privatised to avoid it being used
00082   vnl_cholesky(vnl_cholesky const & that);
00083   //: Assignment operator - privatised to avoid it being used
00084   vnl_cholesky& operator=(vnl_cholesky const & that);
00085 };
00086 
00087 #endif // vnl_cholesky_h_

Generated at Fri May 21 01:15:46 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000