00001
00002
00003
00004
00005
00006
00007 #include "strctbse.h"
00008 #include "datahndl.h"
00009 #include "vecbse.h"
00010 #include "matbse.h"
00011 #include "range.h"
00012 #include "camtype.h"
00013 #include "under.h"
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _CAMDOUBLEVECTOR_
00029 #define _CAMDOUBLEVECTOR_
00030
00031 #include "mvaimpexp.h"
00032
00033 class __IMPEXP__ CAMdoubleVector : public CAMvectorBase
00034 {
00035
00036 public :
00037
00038
00039
00040 CAMdoubleVector():CAMvectorBase(CAMType::typeDouble){};
00041 CAMdoubleVector(const CAMdoubleVector& A):CAMvectorBase(*((CAMvectorBase*)&A)){};
00042 CAMdoubleVector(const CAMvectorBase& A):CAMvectorBase(A){};
00043 CAMdoubleVector(long n):CAMvectorBase(CAMType::typeDouble, n){};
00044 CAMdoubleVector(const CAMrange& R1)
00045 : CAMvectorBase(CAMType::typeDouble,R1){};
00046 CAMdoubleVector(const CAMrange& R1,char* RorC)
00047 : CAMvectorBase(CAMType::typeDouble,R1)
00048 {if(RorC[0] == 'r') (*this).initialize(this->transpose());};
00049
00050
00051
00052 void operator = (const CAMdoubleVector& A)
00053 {CAMvectorBase* basePtr = this; const CAMvectorBase* AbasePtr =
00054 (CAMvectorBase*)&A; basePtr->operator=(*AbasePtr);};
00055 void operator =( const CAMvectorBase& A)
00056 {CAMvectorBase* basePtr = this; basePtr->operator=(A);};
00057 void operator = (const CAMmatrixBase& A)
00058 {CAMvectorBase* basePtr = this; basePtr->operator=(A);};
00059 void operator = (double value)
00060 {CAMvectorBase* basePtr = this; basePtr->operator=(value);};
00061
00062
00063
00064 void initialize()
00065 {CAMvectorBase* basePtr = this; basePtr->initialize(CAMType::typeDouble);};
00066 void initialize(const CAMdoubleVector& A)
00067 {CAMvectorBase* basePtr = this; basePtr->initialize(A);};
00068 void initialize(const CAMvectorBase& A)
00069 {CAMvectorBase* basePtr = this; basePtr->initialize(A);};
00070 void initialize(long n)
00071 {CAMvectorBase* basePtr = this; basePtr->initialize(CAMType::typeDouble, n);};
00072 void initialize(const CAMrange& R1)
00073 {CAMvectorBase* basePtr = this; basePtr->initialize(CAMType::typeDouble,R1);};
00074 inline double& operator()(long i1)
00075 {
00076 #ifndef _NO_BOUNDS_CHECK_
00077 long ia, ib;
00078 if(Structure[1].getIndexCount() != 1)
00079 {ia = i1; ib = Structure[2].getIndexBase();}
00080 else
00081 {ia = Structure[1].getIndexBase(); ib = i1;}
00082 CAMvectorBase::indexCheck(Structure,ia,ib);
00083 #endif
00084 long* beginPtr = Structure.indexBeginBase.getDataPointer();
00085
00086 double* dataPtr = (double*)DataP->dataPointer;
00087 long offset = (i1 - *(beginPtr));
00088 return *(dataPtr + offset);
00089 }
00090 inline const double& operator()(long i1) const
00091 {
00092 #ifndef _NO_BOUNDS_CHECK_
00093 long ia, ib;
00094 if(Structure[1].getIndexCount() != 1)
00095 {ia = i1; ib = Structure[2].getIndexBase();}
00096 else
00097 {ia = Structure[1].getIndexBase(); ib = i1;}
00098 CAMvectorBase::indexCheck(Structure,ia,ib);
00099 #endif
00100 const long* beginPtr = Structure.indexBeginBase.getDataPointer();
00101 double* dataPtr = (double*)DataP->dataPointer;
00102 long offset = (i1 - *(beginPtr));
00103 return (*(dataPtr + offset));
00104 };
00105 CAMdoubleVector operator() (const CAMrange& R1)
00106 {
00107 CAMstructureBase Rstructure(Structure);
00108 CAMrange Ra, Rb;
00109 if(Structure[1].getIndexCount() != 1)
00110 {
00111 Ra = R1;
00112 Rb.initialize(Structure[2].getIndexBase(),Structure[2].getIndexBase());
00113 }
00114 else
00115 {
00116 Ra.initialize(Structure[1].getIndexBase(),Structure[1].getIndexBase());
00117 Rb = R1;
00118 }
00119 Rstructure.setStructureSubset(Ra,Rb);
00120 CAMdoubleVector 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 const CAMdoubleVector operator()(const CAMrange& R1) const
00129 {
00130 CAMstructureBase Rstructure(Structure);
00131 CAMrange Ra, Rb;
00132 if(Structure[1].getIndexCount() != 1)
00133 {
00134 Ra = R1;
00135 Rb.initialize(Structure[2].getIndexBase(),Structure[2].getIndexBase());
00136 }
00137 else
00138 {
00139 Ra.initialize(Structure[1].getIndexBase(),Structure[1].getIndexBase());
00140 Rb = R1;
00141 }
00142 Rstructure.setStructureSubset(Ra,Rb);
00143 CAMdoubleVector A;
00144 A.Structure.initialize(Rstructure);
00145 A.DataP = DataP;
00146 A.DataP->incrementReferenceCount();
00147 A.DataP->incrementReferenceCount();
00148 A.referenceFlag = 1;
00149 return A;
00150 }
00151
00152
00153
00154 double* getDataPointer() const {return (double*)DataP->getDataPointer();};
00155
00156 };
00157
00158 #endif
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168