#include <STK_MatrixLowerTriangular.h>
Inherits IArray2D< Real, MatrixLowerTriangular >.
Definition at line 66 of file STK_MatrixLowerTriangular.h.
Column Real.
Definition at line 79 of file STK_MatrixLowerTriangular.h.
Row Real.
Definition at line 82 of file STK_MatrixLowerTriangular.h.
Real for the Interface Class.
Definition at line 85 of file STK_MatrixLowerTriangular.h.
Default Ctor. Default is I=(1:0) and J=(1:0)
| I | range of the Rows | |
| J | range of the Cols |
Definition at line 55 of file STK_MatrixLowerTriangular.cpp.
References STK::IArray2D< Real, MatrixLowerTriangular >::initializeCols().
Referenced by get2D().
00056 : _IArray2DType(I, J) 00057 , defaultConst_(Real()) 00058 { 00059 // initialize vertically the container 00060 this->initializeCols(J); 00061 }
Ctor with rangeVe_ and rageHo_ specified, initialization with a specified value.
| I | range of the Rows | |
| J | range of the Cols | |
| v | initial value in the container |
Definition at line 69 of file STK_MatrixLowerTriangular.cpp.
References STK::Inx::first(), STK::IArrayBase< Real * >::getData(), STK::IArray2D< Real, MatrixLowerTriangular >::initializeCols(), STK::Inx::last(), and STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::rangeCols_.
00073 : _IArray2DType(I, J) 00074 , defaultConst_(Real()) 00075 { 00076 // initialize vertically the container 00077 this->initializeCols(J); 00078 // initialize with v 00079 for (Integer j = J.first(); j <= J.last(); j++) 00080 { 00081 Real* p(this->getData(j)); 00082 Integer beg(this->rangeCols_[j].first()); 00083 Integer end(this->rangeCols_[j].last()); 00084 00085 for (Integer i = beg; i <= end; i++) p[i] = v; 00086 } 00087 }
| STK::MatrixLowerTriangular::MatrixLowerTriangular | ( | const MatrixLowerTriangular & | T, | |
| bool | ref = false | |||
| ) |
Copy Ctor.
| T | the container to copy | |
| ref | true if T is wrapped |
Definition at line 93 of file STK_MatrixLowerTriangular.cpp.
References STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::firstCol(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::firstRow(), STK::IArrayBase< DATA >::getData(), STK::IArrayBase< Real * >::getData(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::getRangeHo(), STK::IArray2D< Real, MatrixLowerTriangular >::initializeCols(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::lastCol(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::lastRow(), and pt().
00096 : _IArray2DType(T, ref) 00097 , defaultConst_(Real()) 00098 { 00099 if (!ref) 00100 { 00101 // initialize vertically the container 00102 this->initializeCols(T.getRangeHo()); 00103 // initialize with T 00104 for (Integer j=T.firstCol(); j<=T.lastCol(); j++) 00105 { 00106 Real* p(this->getData(j)); 00107 const Real* pt= T.getData(j); 00108 00109 for (Integer i=T.firstRow(); i<=T.lastRow(); i++) p[i]= pt[i]; 00110 } 00111 } 00112 }
| STK::MatrixLowerTriangular::MatrixLowerTriangular | ( | const _IArray2DType & | T, | |
| const Inx & | I, | |||
| const Inx & | J | |||
| ) |
Ctor by reference, ref_=1.
| T | the container to wrap | |
| I | range of the Rows to wrap | |
| J | range of the Cols to wrap |
Definition at line 119 of file STK_MatrixLowerTriangular.cpp.
00123 : _IArray2DType(T, I, J) 00124 , defaultConst_(Real()) 00125 { ;}
Wrapper Ctor. Contruct a reference container.
| q | pointer on the data | |
| I | range of the Rows to wrap | |
| J | range of the Cols to wrap |
Definition at line 132 of file STK_MatrixLowerTriangular.cpp.
00136 : _IArray2DType(q, I, J) 00137 , defaultConst_(Real()) 00138 { ;}
| STK::MatrixLowerTriangular::~MatrixLowerTriangular | ( | ) | [virtual] |
Compute the first index of the column icol.
| icol | the index of the column we want to compute the first index |
Definition at line 133 of file STK_MatrixLowerTriangular.h.
References STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstCol(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstRow(), and STK::max().
Referenced by compRangeVe(), compSizeVe(), and isInside().
Compute the last index of the column icol. For a lower triangular matrix, this is the index of the last row.
| icol | the column we want to know the last index |
Definition at line 142 of file STK_MatrixLowerTriangular.h.
References STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::lastRow().
00143 { 00144 return this->lastRow(); 00145 }
Compute the size of the column icol.
| icol | the column we want to know the size |
Definition at line 150 of file STK_MatrixLowerTriangular.h.
References compFirstVe(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::lastRow(), and STK::max().
00151 { 00152 return max(this->lastRow()-compFirstVe(icol)+1, Integer(0)); 00153 }
compute the range of the effectively stored elements in the col icol.
| icol | the number of the column to compute the range |
Definition at line 159 of file STK_MatrixLowerTriangular.h.
References compFirstVe(), and STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::lastRow().
Referenced by getCol().
00160 { 00161 return Inx(compFirstVe(icol), this->lastRow()); 00162 }
compute the beginning of the row irow.
| irow | the column to compute the beginning |
Definition at line 167 of file STK_MatrixLowerTriangular.h.
References STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstCol().
00168 { 00169 return this->firstCol(); 00170 }
compute the end of the row irow.
| irow | the column to compute the end |
Definition at line 175 of file STK_MatrixLowerTriangular.h.
References STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstCol(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstRow(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::lastCol(), and STK::min().
Referenced by compRangeHo(), and compSizeHo().
00176 { 00177 return min( this->firstCol()+ irow - this->firstRow(), 00178 this->lastCol()); 00179 }
compute the true number of element of the row irow.
| irow | the number of the column to compute the size |
Definition at line 184 of file STK_MatrixLowerTriangular.h.
References compLastHo(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstCol(), and STK::max().
00185 { 00186 return max(compLastHo(irow)-this->firstCol()+1, Integer(0)); 00187 }
compute the range of the effectively stored elements in the row irow.
| irow | the number of the row to compute the range |
Definition at line 193 of file STK_MatrixLowerTriangular.h.
References compLastHo(), and STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstCol().
Referenced by getRow().
00194 { 00195 return Inx(this->firstCol(), this->compLastHo(irow)); 00196 }
function for determining if the row i of the col j is in the lower triangular part.
| i | the number of the row | |
| j | the number of the col |
Definition at line 203 of file STK_MatrixLowerTriangular.h.
References compFirstVe().
Referenced by getElt().
00204 { 00205 return (i>=compFirstVe(j)); 00206 }
access to one element.
| i | index of the row | |
| j | index of the col |
Definition at line 214 of file STK_MatrixLowerTriangular.h.
References default_, STK::IArrayBase< Real * >::getData(), and isInside().
access to one element const.
| i | index of the row | |
| j | index of the col |
Definition at line 223 of file STK_MatrixLowerTriangular.h.
References defaultConst_, STK::IArrayBase< Real * >::getData(), and isInside().
00224 { 00225 if (isInside(i, j)) 00226 { 00227 return this->getData(j)[i]; 00228 } 00229 else 00230 { 00231 return defaultConst_; 00232 } 00233 }
| MatrixLowerTriangular STK::MatrixLowerTriangular::get2D | ( | const Inx & | I, | |
| const Inx & | J | |||
| ) | const [inline] |
access to a sub-array.
| I | range of the rows | |
| J | range of the cols |
Definition at line 239 of file STK_MatrixLowerTriangular.h.
References MatrixLowerTriangular().
00240 { 00241 return MatrixLowerTriangular(*this, I, J); 00242 }
| _Cont1DType STK::MatrixLowerTriangular::getCol | ( | const Inx & | I, | |
| Integer | j | |||
| ) | const [inline] |
access to a sub-col.
| I | range of the rows | |
| j | index of the col |
Definition at line 248 of file STK_MatrixLowerTriangular.h.
References compRangeVe(), STK::IArrayBase< Real * >::getData(), and STK::Inx::inf().
00249 { 00250 return _Cont1DType( this->getData(j) 00251 , Inx::inf(I, compRangeVe(j)) 00252 , j); 00253 }
| _ContHoType STK::MatrixLowerTriangular::getRow | ( | Integer | i, | |
| const Inx & | J | |||
| ) | const [inline] |
access to a sub-row.
| i | index of the row | |
| J | range of the cols |
Definition at line 259 of file STK_MatrixLowerTriangular.h.
References compRangeHo(), and STK::Inx::inf().
00260 { 00261 return _ContHoType(*this, Inx::inf(J, compRangeHo(i)), i); 00262 }
| MatrixLowerTriangular & STK::MatrixLowerTriangular::operator= | ( | const MatrixLowerTriangular & | T | ) |
operator = : overwrite the MatrixLowerTriangular with T. We resize the object if this and T does not have the same size but if they have the same size, we don't modify the range of the object.
| T | the container to copy |
Definition at line 152 of file STK_MatrixLowerTriangular.cpp.
References STK::ITContainer1D< TYPE, TContainer1D >::first(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstCol(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::firstCol(), STK::IArrayBase< DATA >::getData(), STK::IArrayBase< Real * >::getData(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::getRangeHo(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::getRangeVe(), STK::IArray2D< Real, MatrixLowerTriangular >::initialize(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::lastCol(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::lastCol(), pt(), STK::IArray2DBase< TYPE, PTRCOL, TArrayHo, TArrayVe, TArray2D >::rangeCols_, STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::rangeCols_, STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::sizeHo(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::sizeHo(), STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::sizeVe(), and STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::sizeVe().
00153 { 00154 // Resize if necessary. 00155 if ( (this->sizeVe() != T.sizeVe())||(this->sizeHo() != T.sizeHo())) 00156 { 00157 this->initialize(T.getRangeVe(), T.getRangeHo()); 00158 } 00159 // coopy without overlapping 00160 if (T.firstCol()>=this->firstCol()) 00161 { 00162 for ( Integer jt=T.firstCol(), j=this->firstCol() 00163 ; jt<=T.lastCol() 00164 ; j++, jt++) 00165 { 00166 Real* p(this->getData(j)); 00167 const Real* pt= T.getData(jt); 00168 Integer beg(this->rangeCols_[j].first()); 00169 Integer end(this->rangeCols_[j].last()); 00170 Integer tbeg(T.rangeCols_[j].first()); 00171 00172 for (Integer i=beg, it=tbeg; i<=end; i++, it++) 00173 p[i]= pt[it]; 00174 } 00175 return *this; 00176 } 00177 // T.firstCol()<this->firstCol() 00178 for ( Integer jt=T.lastCol(), j=this->lastCol() 00179 ; jt>=T.firstCol() 00180 ; j--, jt--) 00181 { 00182 Real* p(this->getData(j)); 00183 const Real* pt= T.getData(jt); 00184 Integer beg(this->rangeCols_[j].first()); 00185 Integer end(this->rangeCols_[j].last()); 00186 Integer tbeg(T.rangeCols_[j].first()); 00187 00188 for (Integer i=beg, it=tbeg; i<=end; i++, it++) 00189 p[i]= pt[it]; 00190 } 00191 return *this; 00192 }
| MatrixLowerTriangular& STK::MatrixLowerTriangular::operator= | ( | const Real & | v | ) | [inline] |
operator= : set the container to a constant value.
| v | the value to set |
Definition at line 276 of file STK_MatrixLowerTriangular.h.
References STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::firstCol(), STK::IArrayBase< Real * >::getData(), STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::lastCol(), and STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::rangeCols_.
00277 { 00278 for (Integer j=this->firstCol(); j<=this->lastCol(); j++) 00279 { 00280 Real* p(this->getData(j)); 00281 Integer beg(this->rangeCols_[j].first()); 00282 Integer end(this->rangeCols_[j].last()); 00283 00284 for (Integer i=beg; i<=end; i++) p[i]= v; 00285 } 00286 return *this; 00287 }
const Real STK::MatrixLowerTriangular::defaultConst_ [private] |
Default constant value (Real(0)).
Definition at line 70 of file STK_MatrixLowerTriangular.h.
Referenced by getElt().
Real STK::MatrixLowerTriangular::default_ [private] |
Default non constant value.
Definition at line 73 of file STK_MatrixLowerTriangular.h.
Referenced by getElt().
1.5.8