core/vnl/vnl_fastops.h
Go to the documentation of this file.
00001 // This is core/vnl/vnl_fastops.h
00002 #ifndef vnl_fastops_h_
00003 #define vnl_fastops_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 //  \file
00009 //  \brief Collection of C-style matrix functions
00010 //  \author Andrew W. Fitzgibbon, Oxford RRG
00011 //  \date   09 Dec 96
00012 //
00013 // \verbatim
00014 //  Modifications
00015 //   Feb.2002 -Peter Vanroose- brief doxygen comment placed on single line
00016 //   Jun.2004 -Peter Vanroose- Added inc_X_by_ABt dec_X_by_AtB {inc,dec}_X_by_AB
00017 //   Jun.2004 -Peter Vanroose- First step to migrate towards non-pointer args
00018 //   Mar.2007 -Peter Vanroose- Commented deprecated versions of the functions
00019 // \endverbatim
00020 
00021 #include <vnl/vnl_vector.h>
00022 #include <vnl/vnl_matrix.h>
00023 
00024 //: Collection of C-style matrix functions for the most time-critical applications.
00025 // In general, however one should consider using the vnl_transpose envelope-letter
00026 // class to achieve the same results with about a 10% speed penalty.
00027 class vnl_fastops
00028 {
00029  public:
00030   static void AtA(vnl_matrix<double>& out, const vnl_matrix<double>& A);
00031   static void AB (vnl_matrix<double>& out, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00032   static void AtB(vnl_matrix<double>& out, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00033   static void AtB(vnl_vector<double>& out, const vnl_matrix<double>& A, const vnl_vector<double>& b);
00034   static void Ab (vnl_vector<double>& out, const vnl_matrix<double>& A, const vnl_vector<double>& b);
00035   static void ABt(vnl_matrix<double>& out, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00036 
00037   static double btAb (const vnl_matrix<double>& A, const vnl_vector<double>& b);
00038 
00039   static void ABAt(vnl_matrix<double>& out, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00040 
00041   static void inc_X_by_AtA(vnl_matrix<double>& X, const vnl_matrix<double>& A);
00042   static void inc_X_by_AB (vnl_matrix<double>& X, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00043   static void inc_X_by_AtB(vnl_matrix<double>& X, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00044   static void inc_X_by_AtB(vnl_vector<double>& X, const vnl_matrix<double>& A, const vnl_vector<double>& b);
00045   static void inc_X_by_ABt(vnl_matrix<double>& X, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00046   static void inc_X_by_ABAt(vnl_matrix<double>& X, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00047 
00048   static void dec_X_by_AtA(vnl_matrix<double>& X, const vnl_matrix<double>& A);
00049   static void dec_X_by_AB (vnl_matrix<double>& X, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00050   static void dec_X_by_AtB(vnl_matrix<double>& X, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00051   static void dec_X_by_AtB(vnl_vector<double>& X, const vnl_matrix<double>& A, const vnl_vector<double>& b);
00052   static void dec_X_by_ABt(vnl_matrix<double>& X, const vnl_matrix<double>& A, const vnl_matrix<double>& B);
00053 
00054 #if 0 // deprecated; use the ref-style versions instead!
00055   static void AtA(const vnl_matrix<double>& A, vnl_matrix<double>* out) {
00056     VXL_DEPRECATED("vnl_fastops::AtA"); AtA(*out, A); }
00057   static void AB (const vnl_matrix<double>& A, const vnl_matrix<double>& B, vnl_matrix<double>* out) {
00058     VXL_DEPRECATED("vnl_fastops::AA"); AB(*out, A,B); }
00059   static void AtB(const vnl_matrix<double>& A, const vnl_matrix<double>& B, vnl_matrix<double>* out) {
00060     VXL_DEPRECATED("vnl_fastops::AtB"); AtB(*out, A,B); }
00061   static void AtB(const vnl_matrix<double>& A, const vnl_vector<double>& b, vnl_vector<double>* out) {
00062     VXL_DEPRECATED("vnl_fastops::AtB"); AtB(*out, A,b); }
00063   static void ABt(const vnl_matrix<double>& A, const vnl_matrix<double>& B, vnl_matrix<double>* out) {
00064     VXL_DEPRECATED("vnl_fastops::ABt"); ABt(*out, A,B); }
00065 #endif // 0
00066 
00067  private:
00068   // BLAS-like operations
00069   static double dot(const double* a, const double* b, unsigned int n);
00070 };
00071 
00072 #endif // vnl_fastops_h_