#include <Array.h>
Definition at line 89 of file Array.h.
Public Member Functions | |
| Array () | |
| Array (const int) | |
| Array (const int, const int) | |
| Array (const int, const int, const int) | |
| Array (const int, const int, const int, const int,...) | |
| Array (const int _ndims, const int *_dims) | |
| Array (Array< T > &m) | |
| ~Array () | |
| const T * | DataPtr () |
| T * | Data () |
| Array< T > | Clone () const |
| const int | XDim () const |
| const int | YDim () const |
| const int | ZDim () const |
| const int * | Dims () const |
| const int * | Size () const |
| int | Length () const |
| int | NDims () const |
| void | Init (const T init) |
| Array< T > & | Add (Array< T > &m) |
| Array< T > & | Subtract (Array< T > &m) |
| Array< T > & | Multiply (Array< T > &m) |
| Array< T > & | Divide (Array< T > &m) |
| Array< T > & | Add (T v) |
| Array< T > & | Subtract (T v) |
| Array< T > & | Multiply (T v) |
| Array< T > & | Divide (T v) |
| Array< T > & | operator= (Array< T > &m) |
| Array< T > & | operator= (Matrix< T > &m) |
| Array< T > & | operator= (Vector< T > &m) |
| Array< T > | operator+ () |
| Array< T > | operator- () |
| Array< int > | operator! () |
| T & | operator() (const int i) |
| T & | operator[] (const int i) |
| T & | operator() (const int i, const int j,...) |
| T & | Elem (const int i, const int j,...) |
| Array element access (dim1, dim2, dim3, ...). Bounds are checked. | |
| T & | ElemNC (const int i, const int j,...) |
| Array element access (row,col). Bounds are not checked. | |
| T & | Elem (const int i) |
| Array element access (sequential: column scan). Bounds are checked. | |
| T & | ElemNC (const int i) |
| Array element access (sequential: column scan). Bounds are not checked. | |
| Array< T > & | operator+= (Array< T > &m) |
| Array< T > & | operator-= (Array< T > &m) |
| Array< T > & | operator *= (Array< T > &m) |
| Array< T > & | operator/= (Array< T > &m) |
| Array< T > & | operator+= (T v) |
| Array< T > & | operator-= (T v) |
| Array< T > & | operator *= (T v) |
| Array< T > & | operator/= (T v) |
| Array (Matrix< T > &m) | |
| Array (Vector< T > &m) | |
Static Public Member Functions | |
| bool | IsCompatible (Array< T > &m1, Array< T > &m2) |
| Array< int > | And (Array< T > &m1, Array< T > &m2) |
| Array< int > | Or (Array< T > &m1, Array< T > &m2) |
| Array< int > | Lt (Array< T > &m1, Array< T > &m2) |
| Array< int > | Gt (Array< T > &m1, Array< T > &m2) |
| Array< int > | Le (Array< T > &m1, Array< T > &m2) |
| Array< int > | Ge (Array< T > &m1, Array< T > &m2) |
| Array< int > | Eq (Array< T > &m1, Array< T > &m2) |
| Array< int > | Ne (Array< T > &m1, Array< T > &m2) |
| Array< int > | And (Array< T > &m, T v) |
| Array< int > | Or (Array< T > &m, T v) |
| Array< int > | Lt (Array< T > &m, T v) |
| Array< int > | Gt (Array< T > &m, T v) |
| Array< int > | Le (Array< T > &m, T v) |
| Array< int > | Ge (Array< T > &m, T v) |
| Array< int > | Eq (Array< T > &m, T v) |
| Array< int > | Ne (Array< T > &m, T v) |
| Array< T > | Add (Array< T > &m1, Array< T > &m2) |
| Array< T > | Subtract (Array< T > &m1, Array< T > &m2) |
| Array< T > | Multiply (Array< T > &m1, Array< T > &m2) |
| Array< T > | Divide (Array< T > &m1, Array< T > &m2) |
| Array< T > | Add (Array< T > &m1, T v2) |
| Array< T > | Subtract (Array< T > &m1, T v2) |
| Array< T > | Subtract (T v2, Array< T > &m1) |
| Array< T > | Multiply (Array< T > &m1, T v2) |
| Array< T > | Divide (Array< T > &m1, T v2) |
| Array< T > | Divide (T v2, Array< T > &m1) |
Protected Attributes | |
| T * | data |
| int | ndims |
| int | length |
| int * | dims |
| Cleaner< T > * | clean |
Friends | |
| class | Matrix<T> |
| class | Vector<T> |
| Array< int > | operator && (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator|| (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator< (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator> (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator<= (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator>= (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator== (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator!= (Array< T > &m1, Array< T > &m2) |
| Array< int > | operator && (Array< T > &m, T v) |
| Array< int > | operator && (T v, Array< T > &m) |
| Array< int > | operator|| (Array< T > &m, T v) |
| Array< int > | operator|| (T v, Array< T > &m) |
| Array< int > | operator< (Array< T > &m, T v) |
| Array< int > | operator< (T v, Array< T > &m) |
| Array< int > | operator> (Array< T > &m, T v) |
| Array< int > | operator> (T v, Array< T > &m) |
| Array< int > | operator<= (Array< T > &m, T v) |
| Array< int > | operator<= (T v, Array< T > &m) |
| Array< int > | operator>= (Array< T > &m, T v) |
| Array< int > | operator>= (T v, Array< T > &m) |
| Array< int > | operator== (Array< T > &m, T v) |
| Array< int > | operator== (T v, Array< T > &m) |
| Array< int > | operator!= (Array< T > &m, T v) |
| Array< int > | operator!= (T v, Array< T > &m) |
| Array< T > | operator+ (Array< T > &m1, Array< T > &m2) |
| Array< T > | operator- (Array< T > &m1, Array< T > &m2) |
| Array< T > | operator * (Array< T > &m1, Array< T > &m2) |
| Array< T > | operator/ (Array< T > &m1, Array< T > &m2) |
| Array< T > | operator+ (Array< T > &m, T v) |
| Array< T > | operator+ (T v, Array< T > &m) |
| Array< T > | operator- (Array< T > &m, T v) |
| Array< T > | operator- (T v, Array< T > &m) |
| Array< T > | operator * (Array< T > &m, T v) |
| Array< T > | operator * (T v, Array< T > &m) |
| Array< T > | operator/ (Array< T > &m, T v) |
| Array< T > | operator/ (T v, Array< T > &m) |
|
|||||||||
|
Definition at line 63 of file Array.inl. References Array< T >::clean, Array< T >::data, and Array< T >::dims.
|
|
||||||||||
|
Definition at line 74 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Array< T >::data, Array< T >::dims, Array< T >::length, Array< T >::ndims, and Utility::RunTimeError(). 00075 {
00076 if(xdim < 1)
00077 {
00078 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00079 Utility::RunTimeError("All array dimensions should be larger than 0!");
00080 }
00081
00082 ndims = 1;
00083 length = xdim;
00084 dims = new int[1];
00085 Utility::CheckPointer(dims);
00086 dims[0] = xdim;
00087 data = new T[length];
00088 Utility::CheckPointer(data);
00089
00090 clean = new Cleaner<T>(data);
00091
00092 }
|
|
||||||||||||||||
|
Definition at line 96 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Array< T >::data, Array< T >::dims, Array< T >::length, Array< T >::ndims, and Utility::RunTimeError(). 00097 {
00098 if(xdim < 1 || ydim < 1)
00099 {
00100 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00101 Utility::RunTimeError("All array dimensions should be larger than 0!");
00102 }
00103
00104 ndims = 2;
00105 length = xdim*ydim;
00106 dims = new int[2];
00107 Utility::CheckPointer(dims);
00108 dims[0] = xdim;
00109 dims[1] = ydim;
00110 data = new T[length];
00111 Utility::CheckPointer(data);
00112
00113 clean = new Cleaner<T>(data);
00114
00115 }
|
|
||||||||||||||||||||
|
Definition at line 119 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Array< T >::data, Array< T >::dims, Array< T >::length, Array< T >::ndims, and Utility::RunTimeError(). 00120 {
00121 if(xdim < 1 || ydim < 1 || zdim < 1)
00122 {
00123 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00124 Utility::RunTimeError("All array dimensions should be larger than 0!");
00125 }
00126 ndims = 3;
00127 length = xdim*ydim*zdim;
00128 dims = new int[3];
00129 Utility::CheckPointer(dims);
00130 dims[0] = xdim;
00131 dims[1] = ydim;
00132 dims[2] = zdim;
00133 data = new T[length];
00134 Utility::CheckPointer(data);
00135
00136 clean = new Cleaner<T>(data);
00137
00138 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 142 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Array< T >::data, Array< T >::dims, Array< T >::length, Array< T >::ndims, and Utility::RunTimeError(). 00143 {
00144 int *temp = new int[10];
00145 Utility::CheckPointer(temp);
00146
00147 temp[0] = xdim;
00148 temp[1] = ydim;
00149 temp[2] = zdim;
00150 temp[3] = extradim;
00151
00152 va_list argptr;
00153 va_start(argptr, extradim);
00154 int i = 4;
00155 int a;
00156 while((a = va_arg(argptr, int)) > 0 && i<10)
00157 {
00158 temp[i] = a;
00159 i++;
00160 }
00161 va_end(argptr);
00162
00163 if(a>=0)
00164 {
00165 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00166 Utility::RunTimeError("To create multidimensional arrays of dimension 4 or higher, an extra dimension should be entered as -1 at the end. Dimensionality of arrays cannot exceed 10 !");
00167 }
00168
00169 ndims = i;
00170 length = 1;
00171 dims = new int[ndims];
00172 Utility::CheckPointer(dims);
00173
00174 for(int j=0;j<ndims;j++)
00175 {
00176 if(temp[j] < 1)
00177 {
00178 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00179 Utility::RunTimeError("All array dimensions should be larger than 1!");
00180 }
00181
00182 length *= temp[j];
00183 dims[j] = temp[j];
00184 }
00185 data = new T[length];
00186 Utility::CheckPointer(data);
00187
00188 clean = new Cleaner<T>(data);
00189
00190 }
|
|
||||||||||||||||
|
Definition at line 194 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Array< T >::data, Array< T >::dims, and Array< T >::length. 00195 : ndims(_ndims) 00196 { 00197 dims = new int[ndims]; 00198 Utility::CheckPointer(dims); 00199 00200 length = 1; 00201 for(int j=0;j<ndims;j++) 00202 { 00203 dims[j] = _dims[j]; 00204 length *= _dims[j]; 00205 } 00206 data = new T[length]; 00207 Utility::CheckPointer(data); 00208 00209 clean = new Cleaner<T>(data); 00210 00211 }
|
|
||||||||||
|
Definition at line 216 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Array< T >::data, and Array< T >::dims. 00217 : ndims(m.ndims), length(m.length) 00218 { 00219 dims = new int[ndims]; 00220 Utility::CheckPointer(dims); 00221 00222 for(int j=0;j<ndims;j++) 00223 { 00224 dims[j] = m.dims[j]; 00225 } 00226 00227 data = m.data; 00228 00229 clean = new Cleaner<T>(data); 00230 00231 }
|
|
|||||||||
|
Definition at line 235 of file Array.inl. 00236 {
00237 // cout << "Array destroyed" << endl;
00238 delete [] dims;
00239
00240 // Collect garbage
00241 delete clean;
00242 }
|
|
||||||||||
|
Definition at line 1277 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Matrix< T >::data, Array< T >::data, Array< T >::dims, Matrix< T >::length, Array< T >::length, Matrix< T >::ndims, Array< T >::ndims, Matrix< T >::xDim, and Matrix< T >::yDim. 01278 {
01279 ndims = m.ndims;
01280 length = m.length;
01281 dims = new int[ndims];
01282 Utility::CheckPointer(dims);
01283
01284 dims[0] = m.xDim;
01285 dims[1] = m.yDim;
01286 data = m.data;
01287
01288 clean = new Cleaner<T>(data);
01289
01290 }
|
|
||||||||||
|
|
|
||||||||||
|
Definition at line 909 of file Array.inl. References Array< T >::data. 00910 {
00911 for(int i=0;i<this->length;i++)
00912 {
00913 this->data[i] += v;
00914 }
00915 return *this;
00916 }
|
|
||||||||||
|
Definition at line 828 of file Array.inl. References Array< T >::data, Array< T >::IsCompatible(), and Utility::RunTimeError(). 00829 {
00830 if(!Array<T>::IsCompatible(*this, m))
00831 {
00832 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00833 Utility::RunTimeError("Array sizes are not compatible!");
00834 }
00835
00836 for(int i=0;i<this->length;i++)
00837 {
00838 this->data[i] += m.data[i];
00839 }
00840
00841 return *this;
00842 }
|
|
||||||||||||||||
|
Definition at line 740 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00741 {
00742 Array<T> temp(m1.ndims, m1.dims);
00743 for(int i=0;i<temp.length;i++)
00744 {
00745 temp.data[i] = m1.data[i] + v2;
00746 }
00747 return temp;
00748 }
|
|
||||||||||||||||
|
Definition at line 654 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). Referenced by Array< T >::operator+=(). 00655 {
00656 if(!Array<T>::IsCompatible(m1, m2))
00657 {
00658 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00659 Utility::RunTimeError("Array sizes are not compatible!");
00660 }
00661
00662 Array<T> temp(m1.ndims, m1.dims);
00663 for(int i=0;i<temp.length;i++)
00664 {
00665 temp.data[i] = m1.data[i] + m2.data[i];
00666 }
00667
00668 return temp;
00669 }
|
|
||||||||||||||||
|
Definition at line 541 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00542 {
00543 Array<int> temp(m1.ndims, m1.dims);
00544 for(int i=0;i<temp.Length();i++)
00545 {
00546 temp[i] = (m1.data[i] != 0 && v != 0) ? 1 : 0;
00547 }
00548
00549 return temp;
00550 }
|
|
||||||||||||||||
|
Definition at line 382 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00383 {
00384 if(!Array<T>::IsCompatible(m1, m2))
00385 {
00386 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00387 Utility::RunTimeError("Array sizes are not compatible!");
00388 }
00389
00390 Array<int> temp(m1.ndims, m1.dims);
00391 for(int i=0;i<temp.Length();i++)
00392 {
00393 temp[i] = (m1.data[i] != 0 && m2.data[i] != 0) ? 1 : 0;
00394 }
00395
00396 return temp;
00397 }
|
|
|||||||||
|
Definition at line 261 of file Array.inl. References Array< T >::data. 00262 {
00263 Array<T> temp(this->ndims, this->dims);
00264
00265 // memcopy here...
00266 for(int j=0;j<temp.length;j++)
00267 {
00268 temp.data[j] = this->data[j];
00269 }
00270
00271
00272 return temp;
00273 }
|
|
|||||||||
|
Definition at line 253 of file Array.inl. 00254 {
00255 return data;
00256 }
|
|
|||||||||
|
Definition at line 247 of file Array.inl. 00248 {
00249 return data;
00250 }
|
|
|||||||||
|
Definition at line 309 of file Array.inl. 00310 {
00311 return dims;
00312 }
|
|
||||||||||
|
Definition at line 942 of file Array.inl. References Array< T >::data, and Utility::RunTimeError(). 00943 {
00944 if(v == 0)
00945 {
00946 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00947 Utility::RunTimeError("Divide by zero in matrix by value division!");
00948 }
00949
00950 for(int i=0;i<this->length;i++)
00951 {
00952 this->data[i] /= v;
00953 }
00954 return *this;
00955 }
|
|
||||||||||
|
Definition at line 882 of file Array.inl. References Array< T >::data, Array< T >::IsCompatible(), and Utility::RunTimeError(). 00883 {
00884 if(!Array<T>::IsCompatible(*this, m))
00885 {
00886 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00887 Utility::RunTimeError("Array sizes are not compatible!");
00888 }
00889
00890 for(int i=0;i<this->length;i++)
00891 {
00892 if(m.data[i] != 0)
00893 {
00894 this->data[i] /= m.data[i];
00895 }
00896 else
00897 {
00898 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00899 Utility::RunTimeError("Divide by zero in matrix division!");
00900 }
00901 }
00902
00903 return *this;
00904 }
|
|
||||||||||||||||
|
Definition at line 806 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::ndims, and Utility::RunTimeError(). 00807 {
00808 Array<T> temp(m1.ndims, m1.dims);
00809 for(int i=0;i<temp.length;i++)
00810 {
00811 if(m1.data[i] != 0)
00812 {
00813 temp.data[i] = v2 / m1.data[i];
00814 }
00815 else
00816 {
00817 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00818 Utility::RunTimeError("Divide by zero in value by matrix division!");
00819 }
00820 }
00821 return temp;
00822 }
|
|
||||||||||||||||
|
Definition at line 788 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::ndims, and Utility::RunTimeError(). 00789 {
00790 if(v2 == 0)
00791 {
00792 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00793 Utility::RunTimeError("Divide by zero in matrix by value division!");
00794 }
00795
00796 Array<T> temp(m1.ndims, m1.dims);
00797 for(int i=0;i<temp.length;i++)
00798 {
00799 temp.data[i] = m1.data[i] / v2;
00800 }
00801 return temp;
00802 }
|
|
||||||||||||||||
|
Definition at line 711 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). Referenced by Array< T >::operator/=(). 00712 {
00713 if(!Array<T>::IsCompatible(m1, m2))
00714 {
00715 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00716 Utility::RunTimeError("Array sizes are not compatible!");
00717 }
00718
00719 Array<T> temp(m1.ndims, m1.dims);
00720 for(int i=0;i<temp.length;i++)
00721 {
00722 //catch division exception instead... Future work
00723 if(m2.data[i] != 0)
00724 {
00725 temp.data[i] = m1.data[i] / m2.data[i];
00726 }
00727 else
00728 {
00729 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00730 Utility::RunTimeError("Divide by zero in matrix division!");
00731 }
00732 }
00733
00734 return temp;
00735 }
|
|
||||||||||
|
Array element access (sequential: column scan). Bounds are checked.
Definition at line 1125 of file Array.inl. References Array< T >::data, and Utility::RunTimeError(). 01126 {
01127 if(i<0 || i>=length)
01128 {
01129 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
01130 Utility::RunTimeError("Index outside bounds!");
01131 }
01132 return data[i];
01133 }
|
|
||||||||||||||||||||
|
Array element access (dim1, dim2, dim3, ...). Bounds are checked.
Definition at line 1145 of file Array.inl. References Array< T >::data, Array< T >::dims, and Utility::RunTimeError(). 01146 {
01147 int *temp = new int[ndims];
01148 temp[0] = i;
01149 temp[1] = j;
01150
01151 va_list argptr;
01152 va_start(argptr, j);
01153 int lim = 2;
01154 int a;
01155 while(lim<ndims)
01156 {
01157 a = va_arg(argptr, int);
01158 if(a<0 || a>=dims[lim])
01159 {
01160 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
01161 Utility::RunTimeError("Index outside bounds!");
01162 }
01163
01164 temp[lim] = a;
01165 lim++;
01166 }
01167 va_end(argptr);
01168
01169 int ind = 0;
01170 for(int it=0;it<lim;it++)
01171 {
01172 int tempDim = 1;
01173 for(int it2=0;it2<it;it2++)
01174 {
01175 tempDim *= dims[it2];
01176 }
01177
01178 ind += temp[it]*tempDim;
01179 }
01180
01181 return data[ind];
01182 }
|
|
||||||||||
|
Array element access (sequential: column scan). Bounds are not checked.
Definition at line 1137 of file Array.inl. References Array< T >::data. 01138 {
01139 return data[i];
01140 }
|
|
||||||||||||||||||||
|
Array element access (row,col). Bounds are not checked.
Definition at line 1187 of file Array.inl. References Array< T >::data, and Array< T >::dims. 01188 {
01189 int *temp = new int[ndims];
01190 temp[0] = i;
01191 temp[1] = j;
01192
01193 va_list argptr;
01194 va_start(argptr, j);
01195 int lim = 2;
01196 int a;
01197 while(lim<ndims)
01198 {
01199 a = va_arg(argptr, int);
01200 temp[lim] = a;
01201 lim++;
01202 }
01203 va_end(argptr);
01204
01205 int ind = 0;
01206 for(int it=0;it<lim;it++)
01207 {
01208 int tempDim = 1;
01209 for(int it2=0;it2<it;it2++)
01210 {
01211 tempDim *= dims[it2];
01212 }
01213
01214 ind += temp[it]*tempDim;
01215 }
01216
01217 return data[ind];
01218 }
|
|
||||||||||||||||
|
Definition at line 619 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00620 {
00621 Array<int> temp(m1.ndims, m1.dims);
00622 for(int i=0;i<temp.Length();i++)
00623 {
00624 temp[i] = (m1.data[i] == v) ? 1 : 0;
00625 }
00626
00627 return temp;
00628 }
|
|
||||||||||||||||
|
Definition at line 496 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00497 {
00498 if(!Array<T>::IsCompatible(m1, m2))
00499 {
00500 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00501 Utility::RunTimeError("Array sizes are not compatible!");
00502 }
00503
00504 Array<int> temp(m1.ndims, m1.dims);
00505 for(int i=0;i<temp.Length();i++)
00506 {
00507 temp[i] = (m1.data[i] == m2.data[i]) ? 1 : 0;
00508 }
00509
00510 return temp;
00511 }
|
|
||||||||||||||||
|
Definition at line 606 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00607 {
00608 Array<int> temp(m1.ndims, m1.dims);
00609 for(int i=0;i<temp.Length();i++)
00610 {
00611 temp[i] = (m1.data[i] >= v) ? 1 : 0;
00612 }
00613
00614 return temp;
00615 }
|
|
||||||||||||||||
|
Definition at line 477 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00478 {
00479 if(!Array<T>::IsCompatible(m1, m2))
00480 {
00481 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00482 Utility::RunTimeError("Array sizes are not compatible!");
00483 }
00484
00485 Array<int> temp(m1.ndims, m1.dims);
00486 for(int i=0;i<temp.Length();i++)
00487 {
00488 temp[i] = (m1.data[i] >= m2.data[i]) ? 1 : 0;
00489 }
00490
00491 return temp;
00492 }
|
|
||||||||||||||||
|
Definition at line 580 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00581 {
00582 Array<int> temp(m1.ndims, m1.dims);
00583 for(int i=0;i<temp.Length();i++)
00584 {
00585 temp[i] = (m1.data[i] > v) ? 1 : 0;
00586 }
00587
00588 return temp;
00589 }
|
|
||||||||||||||||
|
Definition at line 439 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00440 {
00441 if(!Array<T>::IsCompatible(m1, m2))
00442 {
00443 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00444 Utility::RunTimeError("Array sizes are not compatible!");
00445 }
00446
00447 Array<int> temp(m1.ndims, m1.dims);
00448 for(int i=0;i<temp.Length();i++)
00449 {
00450 temp[i] = (m1.data[i] > m2.data[i]) ? 1 : 0;
00451 }
00452
00453 return temp;
00454 }
|
|
||||||||||
|
Definition at line 333 of file Array.inl. References Array< T >::data. 00334 {
00335 for(int i=0;i<length;i++)
00336 {
00337 data[i] = init;
00338 }
00339 }
|
|
||||||||||||||||
|
Definition at line 354 of file Array.inl. References Array< T >::dims, and Array< T >::ndims. Referenced by Array< T >::Add(), Array< T >::And(), Array< T >::Divide(), Array< T >::Eq(), Array< T >::Ge(), Array< T >::Gt(), Array< T >::Le(), Array< T >::Lt(), Array< T >::Multiply(), Array< T >::Ne(), Array< T >::Or(), and Array< T >::Subtract(). 00355 {
00356 bool temp = true;
00357 if(m1.ndims != m2.ndims)
00358 {
00359 temp = false;
00360 }
00361 else
00362 {
00363 for(int i=0; i<m1.ndims; i++)
00364 {
00365 if(m1.dims[i] != m2.dims[i])
00366 {
00367 temp = false;
00368 break;
00369 }
00370 }
00371 }
00372
00373 return temp;
00374 }
|
|
||||||||||||||||
|
Definition at line 593 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00594 {
00595 Array<int> temp(m1.ndims, m1.dims);
00596 for(int i=0;i<temp.Length();i++)
00597 {
00598 temp[i] = (m1.data[i] <= v) ? 1 : 0;
00599 }
00600
00601 return temp;
00602 }
|
|
||||||||||||||||
|
Definition at line 458 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00459 {
00460 if(!Array<T>::IsCompatible(m1, m2))
00461 {
00462 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00463 Utility::RunTimeError("Array sizes are not compatible!");
00464 }
00465
00466 Array<int> temp(m1.ndims, m1.dims);
00467 for(int i=0;i<temp.Length();i++)
00468 {
00469 temp[i] = (m1.data[i] <= m2.data[i]) ? 1 : 0;
00470 }
00471
00472 return temp;
00473 }
|
|
|||||||||
|
Definition at line 321 of file Array.inl. 00322 {
00323 return length;
00324 }
|
|
||||||||||||||||
|
Definition at line 567 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00568 {
00569 Array<int> temp(m1.ndims, m1.dims);
00570 for(int i=0;i<temp.Length();i++)
00571 {
00572 temp[i] = (m1.data[i] < v) ? 1 : 0;
00573 }
00574
00575 return temp;
00576 }
|
|
||||||||||||||||
|
Definition at line 420 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00421 {
00422 if(!Array<T>::IsCompatible(m1, m2))
00423 {
00424 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00425 Utility::RunTimeError("Array sizes are not compatible!");
00426 }
00427
00428 Array<int> temp(m1.ndims, m1.dims);
00429 for(int i=0;i<temp.Length();i++)
00430 {
00431 temp[i] = (m1.data[i] < m2.data[i]) ? 1 : 0;
00432 }
00433
00434 return temp;
00435 }
|
|
||||||||||
|
Definition at line 931 of file Array.inl. References Array< T >::data. 00932 {
00933 for(int i=0;i<this->length;i++)
00934 {
00935 this->data[i] *= v;
00936 }
00937 return *this;
00938 }
|
|
||||||||||
|
Definition at line 864 of file Array.inl. References Array< T >::data, Array< T >::IsCompatible(), and Utility::RunTimeError(). 00865 {
00866 if(!Array<T>::IsCompatible(*this, m))
00867 {
00868 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00869 Utility::RunTimeError("Array sizes are not compatible!");
00870 }
00871
00872 for(int i=0;i<this->length;i++)
00873 {
00874 this->data[i] *= m.data[i];
00875 }
00876
00877 return *this;
00878 }
|
|
||||||||||||||||
|
Definition at line 776 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00777 {
00778 Array<T> temp(m1.ndims, m1.dims);
00779 for(int i=0;i<temp.length;i++)
00780 {
00781 temp.data[i] = m1.data[i] * v2;
00782 }
00783 return temp;
00784 }
|
|
||||||||||||||||
|
Definition at line 692 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). Referenced by Array< T >::operator *=(). 00693 {
00694 if(!Array<T>::IsCompatible(m1, m2))
00695 {
00696 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00697 Utility::RunTimeError("Array sizes are not compatible!");
00698 }
00699
00700 Array<T> temp(m1.ndims, m1.dims);
00701 for(int i=0;i<temp.length;i++)
00702 {
00703 temp.data[i] = m1.data[i] * m2.data[i];
00704 }
00705
00706 return temp;
00707 }
|
|
|||||||||
|
Definition at line 327 of file Array.inl. 00328 {
00329 return ndims;
00330 }
|
|
||||||||||||||||
|
Definition at line 632 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00633 {
00634 Array<int> temp(m1.ndims, m1.dims);
00635 for(int i=0;i<temp.Length();i++)
00636 {
00637 temp[i] = (m1.data[i] != v) ? 1 : 0;
00638 }
00639
00640 return temp;
00641 }
|
|
||||||||||||||||
|
Definition at line 515 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00516 {
00517 if(!Array<T>::IsCompatible(m1, m2))
00518 {
00519 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00520 Utility::RunTimeError("Array sizes are not compatible!");
00521 }
00522
00523 Array<int> temp(m1.ndims, m1.dims);
00524 for(int i=0;i<temp.Length();i++)
00525 {
00526 temp[i] = (m1.data[i] != m2.data[i]) ? 1 : 0;
00527 }
00528
00529 return temp;
00530 }
|
|
||||||||||
|
Definition at line 1263 of file Array.inl. References Array< T >::Multiply(). 01264 {
01265 return this->Multiply(v);
01266 }
|
|
||||||||||
|
Definition at line 1238 of file Array.inl. References Array< T >::Multiply(). 01239 {
01240 return this->Multiply(m);
01241 }
|
|
|||||||||
|
Definition at line 1034 of file Array.inl. References Array< T >::data. 01035 {
01036 Array<int> temp(this->ndims, this->dims);
01037 for(int i=0;i<length;i++)
01038 {
01039 if(data[i] == 0)
01040 {
01041 temp[i] = 1;
01042 }
01043 else
01044 {
01045 temp[i] = 0;
01046 }
01047 }
01048 return temp;
01049 }
|
|
||||||||||||||||||||
|
Definition at line 1082 of file Array.inl. References Array< T >::data, Array< T >::dims, and Utility::RunTimeError(). 01083 {
01084 int *temp = new int[ndims];
01085 temp[0] = i;
01086 temp[1] = j;
01087
01088 va_list argptr;
01089 va_start(argptr, j);
01090 int lim = 2;
01091 int a;
01092 while(lim<ndims)
01093 {
01094 a = va_arg(argptr, int);
01095 if(a<0 || a>=dims[lim])
01096 {
01097 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
01098 Utility::RunTimeError("Index outside bounds!");
01099 }
01100
01101 temp[lim] = a;
01102 lim++;
01103 }
01104 va_end(argptr);
01105
01106 int ind = 0;
01107 for(int it=0;it<lim;it++)
01108 {
01109 int tempDim = 1;
01110 for(int it2=0;it2<it;it2++)
01111 {
01112 tempDim *= dims[it2];
01113 }
01114
01115 ind += temp[it]*tempDim;
01116 }
01117
01118 return data[ind];
01119 }
|
|
||||||||||
|
Definition at line 1058 of file Array.inl. References Array< T >::data, and Utility::RunTimeError(). 01059 {
01060 if(i<0 || i>=length)
01061 {
01062 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
01063 Utility::RunTimeError("Index outside bounds!");
01064 }
01065 return data[i];
01066 }
|
|
|||||||||
|
Definition at line 1017 of file Array.inl. 01018 {
01019 return *this;
01020 }
|
|
||||||||||
|
Definition at line 1251 of file Array.inl. References Array< T >::Add(). 01252 {
01253 return this->Add(v);
01254 }
|
|
||||||||||
|
Definition at line 1226 of file Array.inl. References Array< T >::Add(). 01227 {
01228 return this->Add(m);
01229 }
|
|
|||||||||
|
Definition at line 1023 of file Array.inl. References Array< T >::data, and Matrix< T >::data. 01024 {
01025 Array<T> temp(this->ndims, this->dims);
01026 for(int i=0;i<length;i++)
01027 {
01028 temp.data[i] = - data[i];
01029 }
01030 return temp;
01031 }
|
|
||||||||||
|
Definition at line 1257 of file Array.inl. References Array< T >::Subtract(). 01258 {
01259 return this->Subtract(v);
01260 }
|
|
||||||||||
|
Definition at line 1232 of file Array.inl. References Array< T >::Subtract(). 01233 {
01234 return this->Subtract(m);
01235 }
|
|
||||||||||
|
Definition at line 1269 of file Array.inl. References Array< T >::Divide(). 01270 {
01271 return this->Divide(v);
01272 }
|
|
||||||||||
|
Definition at line 1244 of file Array.inl. References Array< T >::Divide(). 01245 {
01246 return this->Divide(m);
01247 }
|
|
||||||||||
|
|
|
||||||||||
|
Definition at line 993 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Matrix< T >::data, Array< T >::data, Array< T >::dims, Matrix< T >::length, Array< T >::length, Matrix< T >::ndims, Array< T >::ndims, Matrix< T >::xDim, and Matrix< T >::yDim. 00994 {
00995 ndims = m.ndims;
00996 length = m.length;
00997 dims = new int[ndims];
00998 Utility::CheckPointer(dims);
00999
01000 dims[0] = m.xDim;
01001 dims[1] = m.yDim;
01002 data = m.data;
01003
01004 delete clean;
01005 clean = new Cleaner<T>(data);
01006
01007
01008 return *this;
01009 }
|
|
||||||||||
|
Definition at line 972 of file Array.inl. References Utility::CheckPointer(), Array< T >::clean, Array< T >::data, Array< T >::dims, Array< T >::length, and Array< T >::ndims. 00973 {
00974 ndims = m.ndims;
00975 length = m.length;
00976 dims = new int[ndims];
00977 Utility::CheckPointer(dims);
00978
00979 for(int j=0;j<ndims;j++)
00980 {
00981 dims[j] = m.dims[j];
00982 }
00983 data = m.data;
00984
00985 delete clean;
00986 clean = new Cleaner<T>(data);
00987
00988
00989 return *this;
00990 }
|
|
||||||||||
|
Definition at line 1073 of file Array.inl. References Array< T >::data. 01074 {
01075 return data[i];
01076 }
|
|
||||||||||||||||
|
Definition at line 554 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00555 {
00556 Array<int> temp(m1.ndims, m1.dims);
00557 for(int i=0;i<temp.Length();i++)
00558 {
00559 temp[i] = (m1.data[i] == 0 && v == 0) ? 0 : 1;
00560 }
00561
00562 return temp;
00563 }
|
|
||||||||||||||||
|
Definition at line 401 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). 00402 {
00403 if(!Array<T>::IsCompatible(m1, m2))
00404 {
00405 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00406 Utility::RunTimeError("Array sizes are not compatible!");
00407 }
00408
00409 Array<int> temp(m1.ndims, m1.dims);
00410 for(int i=0;i<temp.Length();i++)
00411 {
00412 temp[i] = (m1.data[i] == 0 && m2.data[i] == 0) ? 0 : 1;
00413 }
00414
00415 return temp;
00416 }
|
|
|||||||||
|
Definition at line 315 of file Array.inl. 00316 {
00317 return dims;
00318 }
|
|
||||||||||
|
Definition at line 920 of file Array.inl. References Array< T >::data. 00921 {
00922 for(int i=0;i<this->length;i++)
00923 {
00924 this->data[i] -= v;
00925 }
00926 return *this;
00927 }
|
|
||||||||||
|
Definition at line 846 of file Array.inl. References Array< T >::data, Array< T >::IsCompatible(), and Utility::RunTimeError(). 00847 {
00848 if(!Array<T>::IsCompatible(*this, m))
00849 {
00850 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00851 Utility::RunTimeError("Array sizes are not compatible!");
00852 }
00853
00854 for(int i=0;i<this->length;i++)
00855 {
00856 this->data[i] -= m.data[i];
00857 }
00858
00859 return *this;
00860 }
|
|
||||||||||||||||
|
Definition at line 764 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00765 {
00766 Array<T> temp(m1.ndims, m1.dims);
00767 for(int i=0;i<temp.length;i++)
00768 {
00769 temp.data[i] = v2 - m1.data[i];
00770 }
00771 return temp;
00772 }
|
|
||||||||||||||||
|
Definition at line 752 of file Array.inl. References Array< T >::data, Array< T >::dims, and Array< T >::ndims. 00753 {
00754 Array<T> temp(m1.ndims, m1.dims);
00755 for(int i=0;i<temp.length;i++)
00756 {
00757 temp.data[i] = m1.data[i] - v2;
00758 }
00759 return temp;
00760 }
|
|
||||||||||||||||
|
Definition at line 673 of file Array.inl. References Array< T >::data, Array< T >::dims, Array< T >::IsCompatible(), Array< T >::ndims, and Utility::RunTimeError(). Referenced by Array< T >::operator-=(). 00674 {
00675 if(!Array<T>::IsCompatible(m1, m2))
00676 {
00677 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00678 Utility::RunTimeError("Array sizes are not compatible!");
00679 }
00680
00681 Array<T> temp(m1.ndims, m1.dims);
00682 for(int i=0;i<temp.length;i++)
00683 {
00684 temp.data[i] = m1.data[i] - m2.data[i];
00685 }
00686
00687 return temp;
00688 }
|
|
|||||||||
|
Definition at line 281 of file Array.inl. References Array< T >::dims. Referenced by Matrix< T >::Matrix(). 00282 {
00283 return dims[0];
00284 }
|
|
|||||||||
|
Definition at line 287 of file Array.inl. References Array< T >::dims, Array< T >::ndims, and Utility::RunTimeError(). Referenced by Matrix< T >::Matrix(). 00288 {
00289 if(ndims < 2)
00290 {
00291 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00292 Utility::RunTimeError("YDim(): Number of dimensions is less than 2!");
00293 }
00294 return dims[1];
00295 }
|
|
|||||||||
|
Definition at line 298 of file Array.inl. References Array< T >::dims, Array< T >::ndims, and Utility::RunTimeError(). 00299 {
00300 if(ndims < 3)
00301 {
00302 cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00303 Utility::RunTimeError("ZDim(): Number of dimensions is less than 3!");
00304 }
00305 return dims[2];
00306 }
|
|
|||||
|
|
|
||||||||||||||||
|
Definition at line 271 of file Array.h. 00272 {
00273 return Array<T>::And(m, v);
00274 }
|
|
||||||||||||||||
|
Definition at line 267 of file Array.h. 00268 {
00269 return Array<T>::And(m, v);
00270 }
|
|
||||||||||||||||
|
Definition at line 224 of file Array.h. 00225 {
00226 return Array<T>::And(m1, m2);
00227 }
|
|
||||||||||||||||
|
Definition at line 392 of file Array.h. 00393 {
00394 return Array<T>::Multiply(m, v);
00395 }
|
|
||||||||||||||||
|
Definition at line 387 of file Array.h. 00388 {
00389 return Array<T>::Multiply(m, v);
00390 }
|
|
||||||||||||||||
|
Definition at line 354 of file Array.h. 00355 {
00356 return Array<T>::Multiply(m1, m2);
00357 }
|
|
||||||||||||||||
|
Definition at line 334 of file Array.h. 00335 {
00336 return Array<T>::Ne(m, v);
00337 }
|
|
||||||||||||||||
|
Definition at line 330 of file Array.h. 00331 {
00332 return Array<T>::Ne(m, v);
00333 }
|
|
||||||||||||||||
|
Definition at line 259 of file Array.h. 00260 {
00261 return Array<T>::Ne(m1, m2);
00262 }
|
|
||||||||||||||||
|
Definition at line 372 of file Array.h. 00373 {
00374 return Array<T>::Add(m, v);
00375 }
|
|
||||||||||||||||
|
Definition at line 367 of file Array.h. 00368 {
00369 return Array<T>::Add(m, v);
00370 }
|
|
||||||||||||||||
|
Definition at line 344 of file Array.h. 00345 {
00346 return Array<T>::Add(m1, m2);
00347 }
|
|
||||||||||||||||
|
Definition at line 382 of file Array.h. 00383 {
00384 return Array<T>::Subtract(v, m);
00385 }
|
|
||||||||||||||||
|
Definition at line 377 of file Array.h. 00378 {
00379 return Array<T>::Subtract(m, v);
00380 }
|
|
||||||||||||||||
|
Definition at line 349 of file Array.h. 00350 {
00351 return Array<T>::Subtract(m1, m2);
00352 }
|
|
||||||||||||||||
|
Definition at line 402 of file Array.h. 00403 {
00404 return Array<T>::Divide(v, m);
00405 }
|
|
||||||||||||||||
|
Definition at line 397 of file Array.h. 00398 {
00399 return Array<T>::Divide(m, v);
00400 }
|
|
||||||||||||||||
|
Definition at line 359 of file Array.h. 00360 {
00361 return Array<T>::Divide(m1, m2);
00362 }
|
|
||||||||||||||||
|
Definition at line 289 of file Array.h. 00290 {
00291 return Array<T>::Gt(m, v);
00292 }
|
|
||||||||||||||||
|
Definition at line 285 of file Array.h. 00286 {
00287 return Array<T>::Lt(m, v);
00288 }
|
|
||||||||||||||||
|
Definition at line 234 of file Array.h. 00235 {
00236 return Array<T>::Lt(m1, m2);
00237 }
|
|
||||||||||||||||
|
Definition at line 307 of file Array.h. 00308 {
00309 return Array<T>::Ge(m, v);
00310 }
|
|
||||||||||||||||
|
Definition at line 303 of file Array.h. 00304 {
00305 return Array<T>::Le(m, v);
00306 }
|
|
||||||||||||||||
|
Definition at line 244 of file Array.h. 00245 {
00246 return Array<T>::Le(m1, m2);
00247 }
|
|
||||||||||||||||
|
Definition at line 325 of file Array.h. 00326 {
00327 return Array<T>::Eq(m, v);
00328 }
|
|
||||||||||||||||
|
Definition at line 321 of file Array.h. 00322 {
00323 return Array<T>::Eq(m, v);
00324 }
|
|
||||||||||||||||
|
Definition at line 254 of file Array.h. 00255 {
00256 return Array<T>::Eq(m1, m2);
00257 }
|
|
||||||||||||||||
|
Definition at line 298 of file Array.h. 00299 {
00300 return Array<T>::Lt(m, v);
00301 }
|
|
||||||||||||||||
|
Definition at line 294 of file Array.h. 00295 {
00296 return Array<T>::Gt(m, v);
00297 }
|
|
||||||||||||||||
|
Definition at line 239 of file Array.h. 00240 {
00241 return Array<T>::Gt(m1, m2);
00242 }
|
|
||||||||||||||||
|
Definition at line 316 of file Array.h. 00317 {
00318 return Array<T>::Le(m, v);
00319 }
|
|
||||||||||||||||
|
Definition at line 312 of file Array.h. 00313 {
00314 return Array<T>::Ge(m, v);
00315 }
|
|
||||||||||||||||
|
Definition at line 249 of file Array.h. 00250 {
00251 return Array<T>::Ge(m1, m2);
00252 }
|
|
||||||||||||||||
|
Definition at line 280 of file Array.h. 00281 {
00282 return Array<T>::Or(m, v);
00283 }
|
|
||||||||||||||||
|
Definition at line 276 of file Array.h. 00277 {
00278 return Array<T>::Or(m, v);
00279 }
|
|
||||||||||||||||
|
Definition at line 229 of file Array.h. 00230 {
00231 return Array<T>::Or(m1, m2);
00232 }
|
|
|||||
|
|
|
|||||
|
Definition at line 101 of file Array.h. Referenced by Array< T >::Array(), and Array< T >::operator=(). |
|
|||||
|
|||||
|
|||||
|
Definition at line 99 of file Array.h. Referenced by Array< T >::Array(), Matrix< T >::Matrix(), Vector< T >::operator=(), Matrix< T >::operator=(), Array< T >::operator=(), and Vector< T >::Vector(). |
|
|||||