dmatrix.h

Go to the documentation of this file.
00001 //
00002 //******************************************************************************
00003 //                    DMATRIX.H
00004 //******************************************************************************
00005 //
00006 
00007 #include "strctbse.h"
00008 #include "datahndl.h"
00009 #include "matbse.h"
00010 #include "vecbse.h" 
00011 #include "range.h"
00012 #include "camtype.h"
00013 #include "under.h"
00014 
00015 //
00016 //  
00017 //
00018 //
00019 //********************************************************************************
00020 //
00021 //            Chris Anderson  (C) UCLA
00022 //
00023 //            Thu Nov 02 13:42:45 1995
00024 //
00025 //********************************************************************************
00026 //
00027 
00028 #ifndef _CAMDOUBLEMATRIX_
00029 #define _CAMDOUBLEMATRIX_
00030 
00031 #include "mvaimpexp.h"
00032 
00033 class __IMPEXP__ CAMdoubleMatrix : public CAMmatrixBase
00034 {
00035 
00036 public :
00037 
00038 //
00039 //  Constructors
00040 //
00041     CAMdoubleMatrix():CAMmatrixBase(CAMType::typeDouble){};
00042     CAMdoubleMatrix(const CAMdoubleMatrix& A):CAMmatrixBase(*((CAMmatrixBase*)&A)){};
00043     CAMdoubleMatrix(const CAMmatrixBase& A):CAMmatrixBase(A){};
00044     CAMdoubleMatrix(const CAMrange& R1, const CAMrange& R2) 
00045     : CAMmatrixBase(CAMType::typeDouble,R1, R2){}; 
00046 //
00047 //  Assignment
00048 //
00049     void  operator = (const CAMdoubleMatrix& A)
00050     {CAMmatrixBase* basePtr = this; const CAMmatrixBase* AbasePtr =
00051     (CAMmatrixBase*)&A; basePtr->operator=(*AbasePtr);};
00052     void  operator =( const CAMmatrixBase& A)
00053     {CAMmatrixBase* basePtr = this; basePtr->operator=(A);};
00054      void  operator = (const CAMvectorBase& A) 
00055  {CAMmatrixBase* basePtr = this; basePtr->operator=(A);};
00056     void  operator = (double value)
00057     {CAMmatrixBase* basePtr = this; basePtr->operator=(value);};
00058 //
00059 //  initialization
00060 //
00061     void  initialize()
00062     {CAMmatrixBase* basePtr = this; basePtr->initialize(CAMType::typeDouble);};
00063     void  initialize(const CAMdoubleMatrix& A)
00064     {CAMmatrixBase* basePtr = this; basePtr->initialize(A);};
00065     void  initialize(const CAMmatrixBase& A)
00066     {CAMmatrixBase* basePtr = this; basePtr->initialize(A);};
00067     void  initialize(const CAMrange& R1, const CAMrange& R2) 
00068     {CAMmatrixBase* basePtr = this; basePtr->initialize(CAMType::typeDouble,R1, R2);}; 
00069 //
00070 //  Access Functions
00071 //
00072     inline double&  operator()(long i1, long i2)
00073 {
00074 #ifndef _NO_BOUNDS_CHECK_
00075     CAMmatrixBase::indexCheck(Structure,i1,i2);
00076 #endif
00077     long* beginPtr = Structure.indexBeginBase.getDataPointer();
00078     long* endPtr   = Structure.indexEndBase.getDataPointer();
00079     
00080     double* dataPtr =  (double*)DataP->dataPointer; 
00081     
00082     long offset = 
00083     (i1 - *(beginPtr)) + 
00084     ((*endPtr - *beginPtr) + 1)*(i2 - *(beginPtr +1)); 
00085 
00086     return (*(dataPtr + offset));
00087 };
00088     inline const double&  operator()(long i1, long i2) const
00089 { 
00090 #ifndef _NO_BOUNDS_CHECK_
00091     CAMmatrixBase::indexCheck(Structure,i1,i2);
00092 #endif
00093     const long* beginPtr = Structure.indexBeginBase.getDataPointer();
00094     const long* endPtr   = Structure.indexEndBase.getDataPointer();
00095     
00096     double* dataPtr =  (double*)DataP->dataPointer; 
00097     
00098     long offset = 
00099     (i1 - *(beginPtr)) + 
00100     ((*endPtr - *beginPtr) + 1)*(i2 - *(beginPtr +1)); 
00101     
00102     return (*(dataPtr + offset));
00103 };
00104     const CAMdoubleMatrix  operator()(const CAMrange& R1, const CAMrange& R2) const
00105 {
00106     CAMstructureBase Rstructure(Structure);
00107     Rstructure.setStructureSubset(R1,R2);
00108     CAMdoubleMatrix A;
00109     A.Structure.initialize(Rstructure);
00110     A.DataP = DataP;
00111     A.DataP->incrementReferenceCount();
00112     A.DataP->incrementReferenceCount();
00113     A.referenceFlag = 1;
00114     return A;
00115 };
00116     CAMdoubleMatrix  operator() (const CAMrange& R1, const CAMrange& R2)
00117 {
00118     CAMstructureBase Rstructure(Structure);
00119     Rstructure.setStructureSubset(R1,R2);
00120     CAMdoubleMatrix A;
00121     A.Structure.initialize(Rstructure);
00122     A.DataP = DataP;
00123     A.DataP->incrementReferenceCount();
00124     A.DataP->incrementReferenceCount();
00125     A.referenceFlag = 1;
00126     return A;
00127 };
00128 //
00129 //  data pointer access
00130 //
00131     double*  getDataPointer() const {return (double*)DataP->getDataPointer();};
00132 // 
00133 //  Double Matrix Specific Utility Routines  
00134 //
00135     static CAMdoubleMatrix identity(long n);
00136 
00137 };
00138 
00139 #endif
00140 //
00141 //********************************************************************************
00142 //                     Header File End 
00143 //********************************************************************************
00144 //
00145 
00146 
00147 
00148 
00149   

Generated on Wed Aug 6 12:58:45 2003 for Open-Sessame Framework by doxygen1.3