contrib/mul/mbl/mbl_mod_gram_schmidt.h
Go to the documentation of this file.
00001 // This is mul/mbl/mbl_mod_gram_schmidt.h
00002 #ifndef mbl_mod_gram_schmidt_h_
00003 #define mbl_mod_gram_schmidt_h_
00004 //:
00005 // \file
00006 // \brief Orthoganalise a basis using modified Gram-Schmidt (and normalise)
00007 // \author Martin Roberts
00008 //
00009 // Note: Modified Gram-Schmidt is more numerically stable than the classical version
00010 // The partially constructed transformed jth vector is used in the successive projections rather than the untransformed
00011 
00012 #include <vnl/vnl_matrix.h>
00013 
00014 //=======================================================================
00015 //: Orthogonalise a basis using modified Gram-Schmidt
00016 // Transform basis {vk} to orthonormal basis {ek} with k in range 1..N
00017 // \code
00018 // for j = 1 to N
00019 //     ej = vj
00020 //     for k = 1 to j-1
00021 //         ej = ej - <ej,ek>ek   //NB Classical GS has vj in inner product
00022 //     end
00023 //     ej = ej/|ej|
00024 //  end
00025 // \endcode
00026 
00027 //: Convert input basis {v} to orthonormal basis {e}
00028 // Each basis vector is a column of v, and likewise the orthonormal bases are returned as columns of e
00029 void mbl_mod_gram_schmidt(const vnl_matrix<double>& v,
00030                           vnl_matrix<double>& e);
00031 
00032 #endif // mbl_mod_gram_schmidt_h_