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

Public Types | |
| typedef Array1D< Real > | Vector |
| Column Real. | |
| typedef ArrayHo< Real > | Point |
| Row Real. | |
| typedef IArrayBase< Real * > | _IArrayBaseType |
| Real for the Base reference Class. | |
| typedef IArray2D< Real, MatrixUpperTriangular > | _IArray2DType |
| Real for the Interface Class. | |
Public Member Functions | |
| MatrixUpperTriangular (Range const &I=Range(), Range const &J=Range()) | |
| Default constructor Default is I=(1:0) and J=(1:0). | |
| MatrixUpperTriangular (Range const &I, Range const &J, Real const &v) | |
| constructor with rangeVe_ and rageHo_ specified, initialization with a specified value. | |
| MatrixUpperTriangular (const MatrixUpperTriangular &T, bool ref=false) | |
| Copy constructor. | |
| MatrixUpperTriangular (const _IArray2DType &T, Range const &I, Range const &J) | |
| constructor by reference in a given range, ref_=1. | |
| MatrixUpperTriangular (Real **q, Range const &I, Range const &J) | |
| Wrapper constructor Contruct a reference container. | |
| virtual | ~MatrixUpperTriangular () |
| virtual destructor. | |
| 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. | |
| Integer | compFirstVe (Integer const &icol) const |
| compute the begin of the column icol. | |
| Integer | compLastVe (Integer const &icol) const |
| compute the end of the column icol. | |
| Integer | compSizeVe (Integer const &icol) const |
| compute the true number of element of the column icol. | |
| Range | compRangeVe (Integer const &icol) const |
| compute the range of the effectively stored elements in the col icol. | |
| bool | isInside (Integer const &i, Integer const &j) const |
| private function for determining if the element i of the col j is in the upper 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. | |
| MatrixUpperTriangular | 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. | |
| MatrixUpperTriangular & | operator= (const MatrixUpperTriangular &T) |
| Operator = : overwrite the MatrixUpperTriangular with T. | |
| MatrixUpperTriangular & | operator= (Real const &v) |
| Operator = : overwrite with a constant value. | |
Private Attributes | |
| const Real | defaultConst_ |
| Default constant value (Real(0)). | |
| Real | default_ |
| Default non constant value. | |
Declaration of the upper triangular matrix class.
A MatrixUpperTriangular is a column oriented 2D upper 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 upper triangular again using the method IArray2D::update().
Definition at line 55 of file STK_MatrixUpperTriangular.h.
Column Real.
Definition at line 66 of file STK_MatrixUpperTriangular.h.
| typedef ArrayHo<Real> STK::MatrixUpperTriangular::Point |
Row Real.
Definition at line 69 of file STK_MatrixUpperTriangular.h.
Real for the Base reference Class.
Reimplemented from STK::IArray2D< Real, MatrixUpperTriangular >.
Definition at line 72 of file STK_MatrixUpperTriangular.h.
Real for the Interface Class.
Definition at line 76 of file STK_MatrixUpperTriangular.h.
| STK::MatrixUpperTriangular::MatrixUpperTriangular | ( | 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_MatrixUpperTriangular.cpp.
References STK::IArray2D< Real, MatrixUpperTriangular >::initializeCols().
Referenced by get2D().
: _IArray2DType(I, J) , defaultConst_(Real()) { // initialize vertically the container this->initializeCols(J); }
| STK::MatrixUpperTriangular::MatrixUpperTriangular | ( | 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_MatrixUpperTriangular.cpp.
References STK::IArrayBase< Real * >::data(), STK::Range::first(), STK::IArray2D< Real, MatrixUpperTriangular >::initializeCols(), STK::Range::last(), and STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixUpperTriangular >::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::MatrixUpperTriangular::MatrixUpperTriangular | ( | const MatrixUpperTriangular & | T, |
| bool | ref = false |
||
| ) |
Copy constructor.
| T | the container to copy |
| ref | true if T is wrapped |
Definition at line 82 of file STK_MatrixUpperTriangular.cpp.
References STK::IArrayBase< DATA >::data(), STK::IArrayBase< Real * >::data(), STK::IContainer2D::firstCol(), STK::IContainer2D::firstRow(), STK::IArray2D< Real, MatrixUpperTriangular >::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::MatrixUpperTriangular::MatrixUpperTriangular | ( | const _IArray2DType & | T, |
| Range const & | I, | ||
| Range const & | J | ||
| ) |
constructor by reference in a given range, 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_MatrixUpperTriangular.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_MatrixUpperTriangular.cpp.
: _IArray2DType(q, I, J) , defaultConst_(Real()) { ;}
| STK::MatrixUpperTriangular::~MatrixUpperTriangular | ( | ) | [virtual] |
compute the beginning of the row irow.
| irow | the row to compute the begining |
Definition at line 123 of file STK_MatrixUpperTriangular.h.
References STK::IContainer2D::firstCol(), STK::IContainer2D::firstRow(), and STK::max().
Referenced by compRangeHo(), and compSizeHo().
compute the end of the row irow.
| irow | the row to compute the beginning |
Definition at line 133 of file STK_MatrixUpperTriangular.h.
References STK::IContainer2D::lastCol().
{
return this->lastCol();
}
compute the true number of element of the row irow.
| irow | the index of the row we want to compute the size |
Definition at line 141 of file STK_MatrixUpperTriangular.h.
References compFirstHo(), STK::IContainer2D::lastCol(), and STK::max().
{
return max(this->lastCol() - compFirstHo(irow) + 1, (Integer )0);
}
Compute the range of the effectively stored elements in the row irow.
| irow | the number of the row we want to compute the range |
Definition at line 150 of file STK_MatrixUpperTriangular.h.
References compFirstHo(), and STK::IContainer2D::lastCol().
Referenced by row().
{
return Range(compFirstHo(irow), this->lastCol());
}
compute the begin of the column icol.
| icol | the number of the column we want to compute the first index |
Definition at line 158 of file STK_MatrixUpperTriangular.h.
References STK::IContainer2D::firstRow().
{
return this->firstRow();
}
compute the end of the column icol.
| icol | the row to compute the end |
Definition at line 166 of file STK_MatrixUpperTriangular.h.
References STK::IContainer2D::firstCol(), STK::IContainer2D::firstRow(), STK::IContainer2D::lastRow(), and STK::min().
Referenced by compRangeVe(), and compSizeVe().
compute the true number of element of the column icol.
| icol | the number of the column to compute the size |
Definition at line 176 of file STK_MatrixUpperTriangular.h.
References compLastVe(), STK::IContainer2D::firstRow(), and STK::max().
{
return max(compLastVe(icol) - this->firstRow() + 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 185 of file STK_MatrixUpperTriangular.h.
References compLastVe(), and STK::IContainer2D::firstRow().
Referenced by col(), STK::Qr::insertCol(), and STK::Qr::pushBackCol().
{
return Range(this->firstRow(), this->compLastVe(icol));
}
private function for determining if the element i of the col j is in the upper triangular part.
Definition at line 193 of file STK_MatrixUpperTriangular.h.
References STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixUpperTriangular >::rangeCols_.
Referenced by elt().
{ return (i<=this->rangeCols_[j].last());}
access to one element.
Definition at line 197 of file STK_MatrixUpperTriangular.h.
References STK::IArrayBase< Real * >::data(), default_, and isInside().
access to one element const.
Definition at line 201 of file STK_MatrixUpperTriangular.h.
References STK::IArrayBase< Real * >::data(), defaultConst_, and isInside().
{
if (isInside(i,j)) { return this->data(j)[i];}
else { return defaultConst_;}
}
| MatrixUpperTriangular STK::MatrixUpperTriangular::get2D | ( | Range const & | I, |
| Range const & | J | ||
| ) | const [inline] |
access to a sub-array.
Definition at line 207 of file STK_MatrixUpperTriangular.h.
References MatrixUpperTriangular().
{ return MatrixUpperTriangular(*this, I, J);}
access to a part of a column.
| I | range of the rows |
| j | index of the col |
Definition at line 215 of file STK_MatrixUpperTriangular.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 >, MatrixUpperTriangular >.
Definition at line 224 of file STK_MatrixUpperTriangular.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 234 of file STK_MatrixUpperTriangular.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 >, MatrixUpperTriangular >.
Definition at line 243 of file STK_MatrixUpperTriangular.h.
References compRangeHo().
{
return Point(*this, compRangeHo(i), i);
}
| MatrixUpperTriangular & STK::MatrixUpperTriangular::operator= | ( | const MatrixUpperTriangular & | T | ) |
Operator = : overwrite the MatrixUpperTriangular with T.
Definition at line 139 of file STK_MatrixUpperTriangular.cpp.
References STK::IArrayBase< DATA >::data(), STK::IArrayBase< Real * >::data(), STK::ITContainer1D< TYPE, TContainer1D >::first(), STK::IContainer2D::firstCol(), STK::IArray2D< Real, MatrixUpperTriangular >::initialize(), STK::IContainer2D::lastCol(), pt(), STK::IArray2DBase< TYPE, PTRCOL, TArrayHo, TArrayVe, TArray2D >::rangeCols_, STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixUpperTriangular >::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;
}
| MatrixUpperTriangular& STK::MatrixUpperTriangular::operator= | ( | Real const & | v | ) | [inline] |
Operator = : overwrite with a constant value.
Definition at line 253 of file STK_MatrixUpperTriangular.h.
References STK::IArrayBase< Real * >::data(), STK::IContainer2D::firstCol(), STK::IContainer2D::lastCol(), and STK::IArray2DBase< Real, Real *, ArrayHo< Real >, Array1D< Real >, MatrixUpperTriangular >::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::MatrixUpperTriangular::defaultConst_ [private] |
Default constant value (Real(0)).
Definition at line 59 of file STK_MatrixUpperTriangular.h.
Referenced by elt().
Real STK::MatrixUpperTriangular::default_ [private] |
Default non constant value.
Definition at line 62 of file STK_MatrixUpperTriangular.h.
Referenced by elt().