SIBCMatrixMNd.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Crosswalk team
00004 //
00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.  
00006 // Use of this software is subject to the terms of the Autodesk license agreement 
00007 // provided at the time of installation or download, or which otherwise accompanies 
00008 // this software in either electronic or hard copy form.
00009 //
00010 //***************************************************************************************
00011 
00012 
00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00014 #pragma once
00015 #endif
00016 
00017 //******************************************************************************
00018 // Defines
00019 //******************************************************************************
00020 
00021 #ifndef _MATRIXMN_H_
00022 #define _MATRIXMN_H_
00023 
00024 //******************************************************************************
00025 // Includes
00026 //******************************************************************************
00027 #include "SIBCMathLib.h"
00028 
00029 //******************************************************************************
00030 // CSIBCMatrixMNd | General MXN matrix.
00031 //******************************************************************************
00032 
00034 
00045 class XSICOREEXPORT CSIBCMatrixMNd
00046 {
00047     // Public members
00048     public:
00049 
00050         //****************************************
00051         // Constructors/destructor:
00052         //****************************************
00053 
00057         CSIBCMatrixMNd();
00058 
00059         // Destructor.
00060          ~CSIBCMatrixMNd();
00061 
00062         //****************************************
00063         // Matrix modification functions:
00064         //****************************************
00065 
00076         bool SetDimensions(const int in_M, const int in_N);
00077 
00084         bool Set( const CSIBCMatrixMNd& in_mat);
00085 
00092         void Copy( const CSIBCMatrixMNd& in_mat);
00093 
00098         CSIBCMatrixMNd& Transpose(const CSIBCMatrixMNd& in_mat);
00099 
00100         //****************************************
00101         // General access functions:
00102         //****************************************
00103 
00109         int GetNbRow( void ) const;
00110 
00116         int GetNbCol( void ) const;
00117 
00124         double Get( const int in_nRow, const int in_nCol ) const;
00125 
00126         //****************************************
00127         // Matrix element modification functions:
00128         //****************************************
00129         
00137         void Set( int in_nRow, int in_nCol, const double in_dVal );
00138 
00142         void SetIdentity( void );
00143 
00144         //****************************************
00145         // Matrix algebra functions:
00146         //****************************************
00147 
00157         CSIBCMatrixMNd& Mul( const CSIBCMatrixMNd& in_mat1, const CSIBCMatrixMNd& in_mat2 );
00158 
00167         bool Mul( const CSIBCMatrixMNd& in_mat );
00168 
00176         bool LeftMul( const CSIBCMatrixMNd& in_mat );
00177 
00183         bool GrevilleInverse(const CSIBCMatrixMNd& in_mat);
00184 
00193         bool GrevilleInverse(const CSIBCMatrixMNd& in_mat, const unsigned int in_NbRow, const unsigned int in_NbCol);
00194 
00204         CSIBCMatrixMNd& Add( const CSIBCMatrixMNd& in_mat1, const CSIBCMatrixMNd& in_mat2);
00205 
00215         CSIBCMatrixMNd& Sub( const CSIBCMatrixMNd& in_mat1, const CSIBCMatrixMNd& in_mat2);
00216 
00225         CSIBCMatrixMNd& Add( const CSIBCMatrixMNd& in_mat );
00226 
00235         CSIBCMatrixMNd& Sub( const CSIBCMatrixMNd& in_mat );
00236 
00237     // Protected members
00238     protected:
00239 
00240         //****************************************
00241         // Protected data
00242         //****************************************
00243 
00244     // Private members
00245     private:
00246         //****************************************
00247         // Matrix algebra functions:
00248         //****************************************
00249 
00250         // Output the inverse of the input vector.
00251         void InverseVector(double *in_pdVct, double * out_pdInvVct, int in_len);
00252 
00253         // Returns the sum of the absolute values of elements in vector.
00254         double SumAbsVal( double *in_pdVct, int in_len);
00255 
00256         //****************************************
00257         // Private data
00258         //****************************************
00259 
00260         //  Number of rows in the matrix (M)
00261         int m_nRow;
00262 
00263         //  Number of columns in the matrix (N)
00264         int m_nCol;
00265 
00266         //  Pointer to MXN Matrix
00267         double**    m_dMatrixMN;
00268 
00270         // Debugging goodies
00272 
00273         //Disable copy constructor and operator = 
00274         CSIBCMatrixMNd ( const CSIBCMatrixMNd& in_matrix );
00275 
00276         // Assignment operator.
00277         CSIBCMatrixMNd& operator =( const CSIBCMatrixMNd& in_matrix );
00278 };
00279 
00280 #endif // _MATRIXMN_H_