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

vnl_matrix_inverse.h

Go to the documentation of this file.
00001 #ifndef vnl_matrix_inverse_h_
00002 #define vnl_matrix_inverse_h_
00003 
00004 //:
00005 //  \file
00006 //  \brief Calculates inverse of a matrix (wrapper around vnl_svd<double>)
00007 //  \author Andrew W. Fitzgibbon, Oxford RRG, 22 Nov 96
00008 //
00009 //  Modifications
00010 //  dac (Manchester) 28/03/2001: tidied up documentation
00011 
00012 #include <vnl/algo/vnl_svd.h>
00013 
00014 //: Calculates inverse of a matrix (wrapper around vnl_svd<double>)
00015 //  vnl_matrix_inverse is a wrapper around vnl_svd<double> that allows 
00016 //  you to write
00017 //  x = vnl_matrix_inverse(A) * b;
00018 //  This is exactly equivalent to x = vnl_svd<double>(A).solve(b); 
00019 //  but is arguably clearer, and also allows for the vnl_matrix_inverse 
00020 //  class to be changed  to use vnl_qr, say.
00021 //
00022 
00023 template <class T>
00024 struct vnl_matrix_inverse : public vnl_svd<T> {
00025   vnl_matrix_inverse(vnl_matrix<T> const & M): vnl_svd<T>(M) { }
00026   ~vnl_matrix_inverse() {};
00027   
00028   operator vnl_matrix<T> () const { return inverse(); }
00029 };
00030 
00031 template <class T>
00032 inline
00033 vnl_vector<T> operator*(vnl_matrix_inverse<T> const & i,
00034                         vnl_vector<T> const & B)
00035 {
00036   return i.solve(B);
00037 }
00038 
00039 template <class T>
00040 inline
00041 vnl_matrix<T> operator*(vnl_matrix_inverse<T> const & i,
00042                         vnl_matrix<T> const & B)
00043 {
00044   return i.solve(B);
00045 }
00046 
00047 #endif // vnl_matrix_inverse_h_

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