contrib/mul/mbl/mbl_matrix_products.h
Go to the documentation of this file.
00001 // This is mul/mbl/mbl_matrix_products.h
00002 #ifndef mbl_matrix_product_h
00003 #define mbl_matrix_product_h
00004 //:
00005 // \file
00006 // \author Tim Cootes
00007 // \date 25-Apr-2001
00008 // \brief Various specialised versions of matrix product operations
00009 
00010 #include <vnl/vnl_fwd.h>
00011 
00012 //: Compute product AB = A * B
00013 void mbl_matrix_product(vnl_matrix<double>& AB, const vnl_matrix<double>& A,
00014                         const vnl_matrix<double>& B);
00015 
00016 //: Compute product ABt = A * B.transpose()
00017 void mbl_matrix_product_a_bt(vnl_matrix<double>& ABt, const vnl_matrix<double>& A,
00018                              const vnl_matrix<double>& B);
00019 
00020 //: Compute ABt = A * B.transpose() using only first n_cols columns of A and B
00021 void mbl_matrix_product_a_bt(vnl_matrix<double>& ABt,
00022                              const vnl_matrix<double>& A,
00023                              const vnl_matrix<double>& B,
00024                              int n_cols);
00025 
00026 //: Compute AAt = A * A.transpose(), using only first nr x nc partition of A
00027 //  Uses symmetry of result to improve speed
00028 void mbl_matrix_product_a_at(vnl_matrix<double>& AAt,
00029                              const vnl_matrix<double>& A,
00030                              unsigned nr, unsigned nc);
00031 
00032 //: Compute AAt = A * A.transpose()
00033 //  Uses symmetry of result to improve speed
00034 void mbl_matrix_product_a_at(vnl_matrix<double>& AAt,
00035                              const vnl_matrix<double>& A);
00036 
00037 //: Compute product AtB = A.transpose() * B
00038 //  Result is of size A.cols() x B.cols()
00039 void mbl_matrix_product_at_b(vnl_matrix<double>& AtB, const vnl_matrix<double>& A,
00040                              const vnl_matrix<double>& B);
00041 
00042 //: Compute AtB = A.transpose() * B , using first ncols_a cols of A
00043 //  Result is of size ncols_a x B.cols()
00044 void mbl_matrix_product_at_b(vnl_matrix<double>& AtB, const vnl_matrix<double>& A,
00045                              const vnl_matrix<double>& B, int ncols_a);
00046 
00047 //: Compute product AtA = A.transpose() * A using nc cols of A
00048 void mbl_matrix_product_at_a(vnl_matrix<double>& AtA,
00049                              const vnl_matrix<double>& A,
00050                              unsigned nc);
00051 
00052 //: Compute product AtA = A.transpose() * A
00053 void mbl_matrix_product_at_a(vnl_matrix<double>& AtA,
00054                              const vnl_matrix<double>& A);
00055 
00056 //: ADB = A * D * B where D is diagonal with elements d
00057 // A, d, and B should be compatible sizes, ADB will
00058 // be resized to fit.
00059 void mbl_matrix_product_adb(vnl_matrix<double>& ADB,
00060                             const vnl_matrix<double>& A,
00061                             const vnl_vector<double>& d,
00062                             const vnl_matrix<double>& B);
00063 
00064 #endif // mbl_matrix_product_h