SIBCMatrixMNd.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Softimage 3D Games & 3D Bridge team
00004 //
00005 // (c) Copyright 1999-2002 Avid Technology, Inc. . All rights reserved.
00006 //
00007 // SIBCMatrixMNd.h | Main header file for SIBCMatrixMNd implementation
00008 //***************************************************************************************
00009 
00010 /****************************************************************************************
00011 THIS CODE IS PUBLISHED AS A SAMPLE ONLY AND IS PROVIDED "AS IS".
00012 IN NO EVENT SHALL SOFTIMAGE, AVID TECHNOLOGY, INC. AND/OR THEIR RESPECTIVE
00013 SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
00014 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00016 CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE .
00017 
00018 COPYRIGHT NOTICE. Copyright © 1999-2002 Avid Technology Inc. . All rights reserved. 
00019 
00020 SOFTIMAGE is a registered trademark of Avid Technology Inc. or its subsidiaries 
00021 or divisions. Windows NT is a registered trademark of Microsoft Corp. All other
00022 trademarks contained herein are the property of their respective owners. 
00023 ****************************************************************************************/
00024 
00025 
00026 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00027 #pragma once
00028 #endif
00029 
00030 //******************************************************************************
00031 // Defines
00032 //******************************************************************************
00033 
00034 #ifndef _MATRIXMN_H_
00035 #define _MATRIXMN_H_
00036 
00037 //******************************************************************************
00038 // Includes
00039 //******************************************************************************
00040 #include "SIBCMathLib.h"
00041 
00042 //******************************************************************************
00043 // CSIBCMatrixMNd | General MXN matrix.
00044 //******************************************************************************
00045 
00047 
00058 class XSICOREEXPORT CSIBCMatrixMNd
00059 {
00060     // Public members
00061     public:
00062 
00063         //****************************************
00064         // Constructors/destructor:
00065         //****************************************
00066 
00070         CSIBCMatrixMNd();
00071 
00072         // Destructor.
00073          ~CSIBCMatrixMNd();
00074 
00075         //****************************************
00076         // Matrix modification functions:
00077         //****************************************
00078 
00089         bool SetDimensions(const int in_M, const int in_N);
00090 
00097         bool Set( const CSIBCMatrixMNd& in_mat);
00098 
00105         void Copy( const CSIBCMatrixMNd& in_mat);
00106 
00111         CSIBCMatrixMNd& Transpose(const CSIBCMatrixMNd& in_mat);
00112 
00113         //****************************************
00114         // General access functions:
00115         //****************************************
00116 
00122         int GetNbRow( void ) const;
00123 
00129         int GetNbCol( void ) const;
00130 
00137         double Get( const int in_nRow, const int in_nCol ) const;
00138 
00139         //****************************************
00140         // Matrix element modification functions:
00141         //****************************************
00142         
00150         void Set( int in_nRow, int in_nCol, const double in_dVal );
00151 
00155         void SetIdentity( void );
00156 
00157         //****************************************
00158         // Matrix algebra functions:
00159         //****************************************
00160 
00170         CSIBCMatrixMNd& Mul( const CSIBCMatrixMNd& in_mat1, const CSIBCMatrixMNd& in_mat2 );
00171 
00180         bool Mul( const CSIBCMatrixMNd& in_mat );
00181 
00189         bool LeftMul( const CSIBCMatrixMNd& in_mat );
00190 
00196         bool GrevilleInverse(const CSIBCMatrixMNd& in_mat);
00197 
00206         bool GrevilleInverse(const CSIBCMatrixMNd& in_mat, const unsigned int in_NbRow, const unsigned int in_NbCol);
00207 
00217         CSIBCMatrixMNd& Add( const CSIBCMatrixMNd& in_mat1, const CSIBCMatrixMNd& in_mat2);
00218 
00228         CSIBCMatrixMNd& Sub( const CSIBCMatrixMNd& in_mat1, const CSIBCMatrixMNd& in_mat2);
00229 
00238         CSIBCMatrixMNd& Add( const CSIBCMatrixMNd& in_mat );
00239 
00248         CSIBCMatrixMNd& Sub( const CSIBCMatrixMNd& in_mat );
00249 
00250     // Protected members
00251     protected:
00252 
00253         //****************************************
00254         // Protected data
00255         //****************************************
00256 
00257     // Private members
00258     private:
00259         //****************************************
00260         // Matrix algebra functions:
00261         //****************************************
00262 
00263         // Output the inverse of the input vector.
00264         void InverseVector(double *in_pdVct, double * out_pdInvVct, int in_len);
00265 
00266         // Returns the sum of the absolute values of elements in vector.
00267         double SumAbsVal( double *in_pdVct, int in_len);
00268 
00269         //****************************************
00270         // Private data
00271         //****************************************
00272 
00273         //  Number of rows in the matrix (M)
00274         int m_nRow;
00275 
00276         //  Number of columns in the matrix (N)
00277         int m_nCol;
00278 
00279         //  Pointer to MXN Matrix
00280         double**    m_dMatrixMN;
00281 
00283         // Debugging goodies
00285 
00286         //Disable copy constructor and operator = 
00287         CSIBCMatrixMNd ( const CSIBCMatrixMNd& in_matrix );
00288 
00289         // Assignment operator.
00290         CSIBCMatrixMNd& operator =( const CSIBCMatrixMNd& in_matrix );
00291 };
00292 
00293 #endif // _MATRIXMN_H_