|
STK++ 1.0
|
Declaration of the lower triangular matrix class. More...
#include <STK_MatrixLowerTriangular.h>

Public Types | |
| typedef IArray2D< Real, MatrixLowerTriangular > | _IArray2DType |
| Real for the Interface Class. | |
Public Member Functions | |
| MatrixLowerTriangular (Range const &I=Range(), Range const &J=Range()) | |
| Default constructor Default is I=(1:0) and J=(1:0) | |
| MatrixLowerTriangular (Range const &I, Range const &J, Real const &v) | |
| constructor with rangeVe_ and rageHo_ specified, initialization with a specified value. | |
| MatrixLowerTriangular (const MatrixLowerTriangular &T, bool ref=false) | |
| Copy constructor. | |
| MatrixLowerTriangular (const _IArray2DType &T, Range const &I, Range const &J) | |
| constructor by reference, ref_=1. | |
| MatrixLowerTriangular (Real **q, Range const &I, Range const &J) | |
| Wrapper constructor Contruct a reference container. | |
| virtual | ~MatrixLowerTriangular () |
| virtual destructor : use destructor of Array2D. | |
| Integer | compFirstVe (Integer const &icol) const |
| Compute the first index of the column icol. | |
| Integer | compLastVe (Integer const &icol) const |
| Compute the last index of the column icol. | |
| Integer | compSizeVe (Integer const &icol) const |
| Compute the size of the column icol. | |
| Range | compRangeVe (Integer const &icol) const |
| compute the range of the effectively stored elements in the col icol. | |
| Integer | compFirstHo (Integer const &irow) const |
| compute the beginning of the row irow. | |
| Integer | compLastHo (Integer const &irow) const |
| compute the end of the row irow. | |
| Integer | compSizeHo (Integer const &irow) const |
| compute the true number of element of the row irow. | |
| Range | compRangeHo (Integer const &irow) const |
| compute the range of the effectively stored elements in the row irow. | |
| bool | isInside (Integer const &i, Integer const &j) const |
| function for determining if the row i of the col j is in the lower triangular part. | |
| Real & | elt (Integer i, Integer j) |
| access to one element. | |
| Real const & | elt (Integer i, Integer j) const |
| access to one element const. | |
| MatrixLowerTriangular | get2D (Range const &I, Range const &J) const |
| access to a sub-array. | |
| Vector | col (Range const &I, Integer j) const |
| access to a part of a column. | |
| Vector | col (Integer j) const |
| access to a part of a column. | |
| Point | row (Integer i, Range const &J) const |
| access to a part of a row. | |
| Point | row (Integer i) const |
| access to a part of a row. | |
| MatrixLowerTriangular & | operator= (const MatrixLowerTriangular &T) |
| operator = : overwrite the MatrixLowerTriangular with T. | |
| MatrixLowerTriangular & | operator= (Real const &v) |
| operator= : set the container to a constant value. | |
Private Attributes | |
| const Real | defaultConst_ |
| Default constant value (Real(0)). | |
| Real | default_ |
| Default non constant value. | |
Declaration of the lower triangular matrix class.
A MatrixLowerTriangular is a column oriented 2D lower triangular container of Real. It is possible to add/remove rows and columns but in this case the container will no more be triangular. The container can be set lower triangular again using the method IArray2D::update().
Definition at line 55 of file STK_MatrixLowerTriangular.h.
Real for the Interface Class.
Definition at line 66 of file STK_MatrixLowerTriangular.h.
| STK::MatrixLowerTriangular::MatrixLowerTriangular | ( | Range const & | I = Range(), |
| Range const & | J = Range() |
||
| ) |
Default constructor Default is I=(1:0) and J=(1:0)
| I | range of the Rows |
| J | range of the Cols |
Definition at line 44 of file STK_MatrixLowerTriangular.cpp.
References STK::IArray2D< Real, MatrixLowerTriangular >::initializeCols().
Referenced by get2D().
: _IArray2DType(I, J) , defaultConst_(Real()) { // initialize vertically the container this->initializeCols(J); }
| STK::MatrixLowerTriangular::MatrixLowerTriangular | ( | Range const & | I, |
| Range const & | J, | ||
| Real const & | v | ||
| ) |
constructor 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 58 of file STK_MatrixLowerTriangular.cpp.
References STK::IArrayBase< Real * >::data(), STK::Range::first(), STK::IArray2D< Real, MatrixLowerTriangular >::initializeCols(), STK::Range::last(), and STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::rangeCols_.
: _IArray2DType(I, J) , defaultConst_(Real()) { // initialize vertically the container this->initializeCols(J); // initialize with v for (Integer j = J.first(); j <= J.last(); j++) { Real* p(this->data(j)); Integer beg(this->rangeCols_[j].first()); Integer end(this->rangeCols_[j].last()); for (Integer i = beg; i <= end; i++) p[i] = v; } }
| STK::MatrixLowerTriangular::MatrixLowerTriangular | ( | const MatrixLowerTriangular & | T, |
| bool | ref = false |
||
| ) |
Copy constructor.
| T | the container to copy |
| ref | true if T is wrapped |
Definition at line 82 of file STK_MatrixLowerTriangular.cpp.
References STK::IArrayBase< DATA >::data(), STK::IArrayBase< Real * >::data(), STK::IContainer2D::firstCol(), STK::IContainer2D::firstRow(), STK::IArray2D< Real, MatrixLowerTriangular >::initializeCols(), STK::IContainer2D::lastCol(), STK::IContainer2D::lastRow(), pt(), and STK::IContainer2D::rangeHo().
: _IArray2DType(T, ref) , defaultConst_(Real()) { if (!ref) { // initialize vertically the container this->initializeCols(T.rangeHo()); // initialize with T for (Integer j=T.firstCol(); j<=T.lastCol(); j++) { Real* p(this->data(j)); const Real* pt= T.data(j); for (Integer i=T.firstRow(); i<=T.lastRow(); i++) p[i]= pt[i]; } } }
| STK::MatrixLowerTriangular::MatrixLowerTriangular | ( | const _IArray2DType & | T, |
| Range const & | I, | ||
| Range const & | J | ||
| ) |
constructor 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 108 of file STK_MatrixLowerTriangular.cpp.
: _IArray2DType(T, I, J) , defaultConst_(Real()) { ;}
Wrapper constructor 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 121 of file STK_MatrixLowerTriangular.cpp.
: _IArray2DType(q, I, J) , defaultConst_(Real()) { ;}
| STK::MatrixLowerTriangular::~MatrixLowerTriangular | ( | ) | [virtual] |
virtual destructor : use destructor of Array2D.
Definition at line 131 of file STK_MatrixLowerTriangular.cpp.
{ ;}
Compute the first index of the column icol.
| icol | the index of the column we want to compute the first index |
Definition at line 109 of file STK_MatrixLowerTriangular.h.
References STK::IContainer2D::firstCol(), STK::IContainer2D::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 118 of file STK_MatrixLowerTriangular.h.
References STK::IContainer2D::lastRow().
{
return this->lastRow();
}
Compute the size of the column icol.
| icol | the column we want to know the size |
Definition at line 126 of file STK_MatrixLowerTriangular.h.
References compFirstVe(), STK::IContainer2D::lastRow(), and STK::max().
{
return max(this->lastRow()-compFirstVe(icol)+1, Integer(0));
}
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 135 of file STK_MatrixLowerTriangular.h.
References compFirstVe(), and STK::IContainer2D::lastRow().
Referenced by col().
{
return Range(compFirstVe(icol), this->lastRow());
}
compute the beginning of the row irow.
| irow | the column to compute the beginning |
Definition at line 143 of file STK_MatrixLowerTriangular.h.
References STK::IContainer2D::firstCol().
{
return this->firstCol();
}
compute the end of the row irow.
| irow | the column to compute the end |
Definition at line 151 of file STK_MatrixLowerTriangular.h.
References STK::IContainer2D::firstCol(), STK::IContainer2D::firstRow(), STK::IContainer2D::lastCol(), and STK::min().
Referenced by compRangeHo(), and compSizeHo().
compute the true number of element of the row irow.
| irow | the number of the column to compute the size |
Definition at line 160 of file STK_MatrixLowerTriangular.h.
References compLastHo(), STK::IContainer2D::firstCol(), and STK::max().
{
return max(compLastHo(irow)-this->firstCol()+1, Integer(0));
}
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 169 of file STK_MatrixLowerTriangular.h.
References compLastHo(), and STK::IContainer2D::firstCol().
Referenced by row().
{
return Range(this->firstCol(), this->compLastHo(irow));
}
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 179 of file STK_MatrixLowerTriangular.h.
References compFirstVe().
Referenced by elt().
{
return (i>=compFirstVe(j));
}
access to one element.
| i | index of the row |
| j | index of the col |
Definition at line 188 of file STK_MatrixLowerTriangular.h.
References STK::IArrayBase< Real * >::data(), default_, and isInside().
access to one element const.
| i | index of the row |
| j | index of the col |
Definition at line 197 of file STK_MatrixLowerTriangular.h.
References STK::IArrayBase< Real * >::data(), defaultConst_, and isInside().
{
if (isInside(i, j))
{
return this->data(j)[i];
}
else
{
return defaultConst_;
}
}
| MatrixLowerTriangular STK::MatrixLowerTriangular::get2D | ( | Range const & | I, |
| Range const & | J | ||
| ) | const [inline] |
access to a sub-array.
| I | range of the rows |
| J | range of the cols |
Definition at line 213 of file STK_MatrixLowerTriangular.h.
References MatrixLowerTriangular().
{
return MatrixLowerTriangular(*this, I, J);
}
access to a part of a column.
| I | range of the rows |
| j | index of the col |
Definition at line 223 of file STK_MatrixLowerTriangular.h.
References compRangeVe(), STK::IArrayBase< Real * >::data(), and STK::Range::inf().
{
return Vector( this->data(j), Range::inf(I, compRangeVe(j)), j);
}
access to a part of a column.
| j | index of the column |
Reimplemented from STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >.
Definition at line 232 of file STK_MatrixLowerTriangular.h.
References compRangeVe(), and STK::IArrayBase< Real * >::data().
{
return Vector( this->data(j), compRangeVe(j), j);
}
access to a part of a row.
| i | index of the row |
| J | range of the columns |
Definition at line 242 of file STK_MatrixLowerTriangular.h.
References compRangeHo(), and STK::Range::inf().
{
return Point(*this, Range::inf(J, compRangeHo(i)), i);
}
access to a part of a row.
| i | index of the row |
Reimplemented from STK::ITContainer2D< Real, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >.
Definition at line 251 of file STK_MatrixLowerTriangular.h.
References compRangeHo().
{
return Point(*this, compRangeHo(i), i);
}
| 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 141 of file STK_MatrixLowerTriangular.cpp.
References STK::IArrayBase< DATA >::data(), STK::IArrayBase< Real * >::data(), STK::ITContainer1D< TYPE, TContainer1D >::first(), STK::IContainer2D::firstCol(), STK::IArray2D< Real, MatrixLowerTriangular >::initialize(), STK::IContainer2D::lastCol(), pt(), STK::IArray2DBase< TYPE, PTRCOL, TArrayHo, TArrayVe, TArray2D >::rangeCols_, STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::rangeCols_, STK::IContainer2D::rangeHo(), STK::IContainer2D::rangeVe(), STK::IContainer2D::sizeHo(), and STK::IContainer2D::sizeVe().
{
// Resize if necessary.
if ( (this->sizeVe() != T.sizeVe())||(this->sizeHo() != T.sizeHo()))
{
this->initialize(T.rangeVe(), T.rangeHo());
}
// coopy without overlapping
if (T.firstCol()>=this->firstCol())
{
for ( Integer jt=T.firstCol(), j=this->firstCol()
; jt<=T.lastCol()
; j++, jt++)
{
Real* p(this->data(j));
const Real* pt= T.data(jt);
Integer beg(this->rangeCols_[j].first());
Integer end(this->rangeCols_[j].last());
Integer tbeg(T.rangeCols_[j].first());
for (Integer i=beg, it=tbeg; i<=end; i++, it++)
p[i]= pt[it];
}
return *this;
}
// T.firstCol()<this->firstCol()
for ( Integer jt=T.lastCol(), j=this->lastCol()
; jt>=T.firstCol()
; j--, jt--)
{
Real* p(this->data(j));
const Real* pt= T.data(jt);
Integer beg(this->rangeCols_[j].first());
Integer end(this->rangeCols_[j].last());
Integer tbeg(T.rangeCols_[j].first());
for (Integer i=beg, it=tbeg; i<=end; i++, it++)
p[i]= pt[it];
}
return *this;
}
| MatrixLowerTriangular& STK::MatrixLowerTriangular::operator= | ( | Real const & | v | ) | [inline] |
operator= : set the container to a constant value.
| v | the value to set |
Definition at line 267 of file STK_MatrixLowerTriangular.h.
References STK::IArrayBase< Real * >::data(), STK::IContainer2D::firstCol(), STK::IContainer2D::lastCol(), and STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixLowerTriangular >::rangeCols_.
{
for (Integer j=this->firstCol(); j<=this->lastCol(); j++)
{
Real* p(this->data(j));
Integer beg(this->rangeCols_[j].first());
Integer end(this->rangeCols_[j].last());
for (Integer i=beg; i<=end; i++) p[i]= v;
}
return *this;
}
const Real STK::MatrixLowerTriangular::defaultConst_ [private] |
Default constant value (Real(0)).
Definition at line 59 of file STK_MatrixLowerTriangular.h.
Referenced by elt().
Real STK::MatrixLowerTriangular::default_ [private] |
Default non constant value.
Definition at line 62 of file STK_MatrixLowerTriangular.h.
Referenced by elt().