sciMatrix.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------------------------*/
00002 /* COPYRIGHT INRIA 2006                                                                      */
00003 /* File    : sciMatrix.h                                                                     */
00004 /* Authors : Jean-Baptiste Silvy 2006-xxxx                                                   */
00005 /* Desc.   : Allocation and deletion and modifications of matrices of pointers               */
00006 /*           The matrix is stored by colmuns like in Scilab.                                 */
00007 /*           These matrices can be used as generic matrices since they used void * pointers  */
00008 /*-------------------------------------------------------------------------------------------*/
00009 
00010 #ifndef _SCI_MATRIX_H_
00011 #define _SCI_MATRIX_H_
00012 
00013 /*-------------------------------------------------------------------------------------------*/
00017 typedef struct
00018 {
00019   void ** data ; 
00020   int nbCol    ;
00021   int nbRow    ;
00022 }
00023 sciMatrix ;
00024 
00025 /*-------------------------------------------------------------------------------------------*/
00026 /* Constructors */
00031 sciMatrix * emptyMatrix( void ) ;
00032 
00036 sciMatrix * newMatrix( int nbRow, int nbCol ) ;
00037 
00041 sciMatrix * newCompleteMatrix( void ** dataMat, int nbRow, int nbCol ) ;
00043 /* note that we cannot use a copy constructor since we don't know how to copy two elements */
00044 /* of the matrix! Maybe it is possible with some function pointers, but it seems a bit */
00045 /* tricky for me. For something clean, C++ may be better. */
00046 /*-------------------------------------------------------------------------------------------*/
00047 /* destructor */
00052 void deleteMatrix( sciMatrix * mat ) ;
00053 
00057 void desallocateMatrix( sciMatrix * mat ) ;
00059 /*-------------------------------------------------------------------------------------------*/
00060 /* accessors */
00065 void * getMatElement( const sciMatrix * mat, int row, int col ) ;
00066 
00067 int     getMatNbRow( const sciMatrix * mat ) ;
00068 
00069 int     getMatNbCol( const sciMatrix * mat ) ;
00070 
00074 void ** getMatData(  const sciMatrix * mat ) ;
00075 
00081 void setMatElement(    sciMatrix * mat, int row, int col, void * newValue ) ;
00082 
00087 void changeMatElement( sciMatrix * mat, int row, int col, void * newValue ) ;
00088 
00095 void copyMatElement(       sciMatrix * mat      ,
00096                            int             row      ,
00097                            int             col      , 
00098                      const void          * copyValue,
00099                            int             valueSize ) ;
00101 /*-------------------------------------------------------------------------------------------*/
00102 
00103 #endif /* _SCI_MATRIX_H_ */

Generated on Sun Mar 4 15:03:50 2007 for Scilab [trunk] by  doxygen 1.5.1