ICF 3.0.5.47
Technical documentation of ICF Libraries
imath::CVarMatrix Class Reference

Definition of mathematical matrix. More...

#include <CVarMatrix.h>

Inheritance diagram for imath::CVarMatrix:
Collaboration diagram for imath::CVarMatrix:

Public Types

typedef istd::TArray< double, 2 > BaseClass
 
- Public Types inherited from istd::TArray< double, 2 >
typedef TIndex< Dimensions > IndexType
 
typedef TIndex< Dimensions > SizesType
 
typedef double ElementType
 

Public Member Functions

 CVarMatrix ()
 Create empty matrix.
 
 CVarMatrix (CVarMatrix &&matrix)=default
 
 CVarMatrix (const CVarMatrix &matrix)=default
 
 CVarMatrix (istd::CIndex2d size)
 Create matrix with specified size.
 
 CVarMatrix (const CVarVector &vector, bool isTransposed=false)
 Create matrix from vector.
 
void Clear ()
 Set all matrix cells to zero.
 
void InitToIdentity (int size)
 Create identity matrix.
 
double GetElementAt (int x, int y) const
 
double & GetElementRef (int x, int y)
 
double GetMaxElement () const
 Get maximal element.
 
double GetMinElement () const
 
void GetNegated (CVarMatrix &result)
 Get result matrix with negated all elements.
 
void GetAdded (const CVarMatrix &matrix, CVarMatrix &result) const
 Get sum of two matrices.
 
void GetSubstracted (const CVarMatrix &matrix, CVarMatrix &result) const
 Get result of substraction of two matrices.
 
void GetMultiplied (const CVarMatrix &matrix, CVarMatrix &result) const
 Get result of multiplication of two matrices.
 
CVarMatrix GetMultiplied (const CVarMatrix &matrix) const
 Get result of multiplication of two matrices.
 
void GetScaled (double value, CVarMatrix &result) const
 Get result of multiplication of this matrix with scalar value.
 
void GetTransposed (CVarMatrix &result) const
 Get transposed matrix.
 
CVarMatrix GetTransposed () const
 Get transposed matrix.
 
void Transpose ()
 Transpose matrix.
 
double GetTrace () const
 Get trace of this matrix.
 
double GetFrobeniusNorm2 () const
 
double GetFrobeniusNorm () const
 
bool GetTriangleDecomposed (CVarMatrix &result, CVarMatrix *matrix2Ptr=nullptr, int maxColumns=-1, double minHhNorm=I_BIG_EPSILON) const
 Transform matrix to upper triangle form using method of Householder reflexions.
 
bool TransformR (int firstPartWidth)
 Transform this matrix in place.
 
bool GetSolvedTriangle (const CVarMatrix &vector, CVarMatrix &result, double accuracy=I_BIG_EPSILON) const
 Solving of linear system with triangle matrix.
 
bool GetSolvedLSP (const CVarMatrix &vector, CVarMatrix &result, double minHhNorm=I_BIG_EPSILON) const
 Solve 'Least Square Problem'.
 
bool GetDecompositionQDQ (CVarMatrix &matrixQ, CVarVector &diagonalD, double tolerance=I_BIG_EPSILON, int maxIterations=100) const
 Calculate decomposition in form of QDQ where Q is orthogonal matrix and D is diagonal one.
 
void GetColumnVector (int columnIndex, CVarVector &result)
 Get single column as vector.
 
void GetRowVector (int rowIndex, CVarVector &result)
 Get single row as vector.
 
bool Serialize (iser::IArchive &archive)
 
CVarMatrixoperator= (CVarMatrix &&array)=default
 
CVarMatrixoperator= (const CVarMatrix &array)=default
 
CVarMatrix operator+ (const CVarMatrix &b) const
 
CVarMatrix operator- (const CVarMatrix &b) const
 
CVarMatrix operator- ()
 
CVarMatrix operator* (const CVarMatrix &b) const
 
CVarMatrix operator* (double value) const
 
bool operator== (const CVarMatrix &matrix) const
 
bool operator!= (const CVarMatrix &matrix) const
 
- Public Member Functions inherited from istd::TArray< double, 2 >
 TArray ()
 
 TArray (TArray &&array)=default
 
 TArray (const TArray &array)=default
 
 TArray (const SizesType &sizes)
 
void Reset ()
 Removes all elements and set all sizes to 0.
 
bool IsEmpty () const
 Check if this array has no elements.
 
bool IsDimensionsCountFixed () const
 Check, if number dimensions is fixed.
 
int GetDimensionsCount () const
 Get number of dimensions of this array.
 
bool SetDimensionsCount (int count)
 Set number of dimensions of this array.
 
const SizesTypeGetSizes () const
 Get list of all sizes.
 
bool SetSizes (const SizesType &sizes)
 Set list of all sizes.
 
int GetSize (int dimension) const
 Get size of array for specified dimension.
 
bool SetSize (int dimension, int size)
 Set size of array for specified dimension.
 
const double & GetAt (const IndexType &index) const
 Get element stored at specified index.
 
double & GetAtRef (const IndexType &index)
 Get reference to element stored at specified index.
 
void SetAt (const IndexType &index, const double &value)
 Set element at specified index.
 
void SetAllElements (const double &value)
 Set some value to all elements.
 
iterator begin () const
 Get begin value of element access iterator.
 
const iterator & end () const
 Get end value of element access iterator.
 
TArrayoperator= (TArray &&array)=default
 
TArrayoperator= (const TArray &array)=default
 
bool operator== (const TArray< double, Dimensions > &value) const
 
bool operator!= (const TArray< double, Dimensions > &value) const
 
const double & operator[] (const IndexType &index) const
 
double & operator[] (const IndexType &index)
 

Static Public Member Functions

static void SolveRobustLSP (CVarMatrix matrixA, CVarMatrix &matrixY, CVarMatrix &matrixX, double minHhNorm=I_BIG_EPSILON)
 Solve 'Least Square Problem' using robust algorithm.
 

Additional Inherited Members

- Protected Types inherited from istd::TArray< double, 2 >
typedef std::vector< double > Elements
 
- Protected Member Functions inherited from istd::TArray< double, 2 >
int GetElementIndex (const IndexType &index) const
 Get index of element in one dimensional array.
 
void UpdateElementsSize ()
 Update size of elements to size changes.
 
void DeepCopy (const Elements &elements, const SizesType &sizes)
 
- Protected Attributes inherited from istd::TArray< double, 2 >
SizesType m_sizes
 
Elements m_elements
 

Detailed Description

Definition of mathematical matrix.

Definition at line 32 of file CVarMatrix.h.

Member Typedef Documentation

◆ BaseClass

Definition at line 35 of file CVarMatrix.h.

Constructor & Destructor Documentation

◆ CVarMatrix() [1/5]

imath::CVarMatrix::CVarMatrix ( )

Create empty matrix.

◆ CVarMatrix() [2/5]

imath::CVarMatrix::CVarMatrix ( CVarMatrix && matrix)
default

◆ CVarMatrix() [3/5]

imath::CVarMatrix::CVarMatrix ( const CVarMatrix & matrix)
default

◆ CVarMatrix() [4/5]

imath::CVarMatrix::CVarMatrix ( istd::CIndex2d size)
explicit

Create matrix with specified size.

◆ CVarMatrix() [5/5]

imath::CVarMatrix::CVarMatrix ( const CVarVector & vector,
bool isTransposed = false )
explicit

Create matrix from vector.

Member Function Documentation

◆ Clear()

void imath::CVarMatrix::Clear ( )

Set all matrix cells to zero.

◆ GetAdded()

void imath::CVarMatrix::GetAdded ( const CVarMatrix & matrix,
CVarMatrix & result ) const

Get sum of two matrices.

Referenced by operator+().

◆ GetColumnVector()

void imath::CVarMatrix::GetColumnVector ( int columnIndex,
CVarVector & result )

Get single column as vector.

◆ GetDecompositionQDQ()

bool imath::CVarMatrix::GetDecompositionQDQ ( CVarMatrix & matrixQ,
CVarVector & diagonalD,
double tolerance = I_BIG_EPSILON,
int maxIterations = 100 ) const

Calculate decomposition in form of QDQ where Q is orthogonal matrix and D is diagonal one.

It works for square matrix only.

◆ GetElementAt()

double imath::CVarMatrix::GetElementAt ( int x,
int y ) const

◆ GetElementRef()

double & imath::CVarMatrix::GetElementRef ( int x,
int y )

◆ GetFrobeniusNorm()

double imath::CVarMatrix::GetFrobeniusNorm ( ) const

◆ GetFrobeniusNorm2()

double imath::CVarMatrix::GetFrobeniusNorm2 ( ) const

◆ GetMaxElement()

double imath::CVarMatrix::GetMaxElement ( ) const

Get maximal element.

◆ GetMinElement()

double imath::CVarMatrix::GetMinElement ( ) const

◆ GetMultiplied() [1/2]

CVarMatrix imath::CVarMatrix::GetMultiplied ( const CVarMatrix & matrix) const
inline

Get result of multiplication of two matrices.

Definition at line 228 of file CVarMatrix.h.

References GetMultiplied().

◆ GetMultiplied() [2/2]

void imath::CVarMatrix::GetMultiplied ( const CVarMatrix & matrix,
CVarMatrix & result ) const

Get result of multiplication of two matrices.

Referenced by GetMultiplied(), and operator*().

◆ GetNegated()

void imath::CVarMatrix::GetNegated ( CVarMatrix & result)

Get result matrix with negated all elements.

Referenced by operator-().

◆ GetRowVector()

void imath::CVarMatrix::GetRowVector ( int rowIndex,
CVarVector & result )

Get single row as vector.

◆ GetScaled()

void imath::CVarMatrix::GetScaled ( double value,
CVarMatrix & result ) const

Get result of multiplication of this matrix with scalar value.

Referenced by operator*().

◆ GetSolvedLSP()

bool imath::CVarMatrix::GetSolvedLSP ( const CVarMatrix & vector,
CVarMatrix & result,
double minHhNorm = I_BIG_EPSILON ) const

Solve 'Least Square Problem'.

Solve linear Least Square Problem for equation AX = Y, where A is a N * M matrix, N >= M, X is n * k matrix and Y is m * k matrix.

Referenced by imath::TMultidimensionalPolynomial< Dimensions, Element >::ApproximateCoefficientsFromFulcrums().

◆ GetSolvedTriangle()

bool imath::CVarMatrix::GetSolvedTriangle ( const CVarMatrix & vector,
CVarMatrix & result,
double accuracy = I_BIG_EPSILON ) const

Solving of linear system with triangle matrix.

Rx = y, result = x.

Returns
true if linear equation system was solved.

◆ GetSubstracted()

void imath::CVarMatrix::GetSubstracted ( const CVarMatrix & matrix,
CVarMatrix & result ) const

Get result of substraction of two matrices.

Referenced by operator-().

◆ GetTrace()

double imath::CVarMatrix::GetTrace ( ) const

Get trace of this matrix.

◆ GetTransposed() [1/2]

CVarMatrix imath::CVarMatrix::GetTransposed ( ) const

Get transposed matrix.

Referenced by Transpose().

◆ GetTransposed() [2/2]

void imath::CVarMatrix::GetTransposed ( CVarMatrix & result) const

Get transposed matrix.

◆ GetTriangleDecomposed()

bool imath::CVarMatrix::GetTriangleDecomposed ( CVarMatrix & result,
CVarMatrix * matrix2Ptr = nullptr,
int maxColumns = -1,
double minHhNorm = I_BIG_EPSILON ) const

Transform matrix to upper triangle form using method of Householder reflexions.

Parameters
resulttriangle matrix.
matrix2Ptroptional matrix will be transformed using the same reflexions. To realize QR decomposition you can use identity matrix.
maxColumnsoptional maximal number of transformed columns. If it is negative value whole matrix will be transformed.
minHhNormminimal Hausholder reflexion vector length. If any reflexion vector is shorter this method fails.
Returns
true if success.

◆ InitToIdentity()

void imath::CVarMatrix::InitToIdentity ( int size)

Create identity matrix.

◆ operator!=()

bool imath::CVarMatrix::operator!= ( const CVarMatrix & matrix) const

◆ operator*() [1/2]

CVarMatrix imath::CVarMatrix::operator* ( const CVarMatrix & b) const
inline

Definition at line 278 of file CVarMatrix.h.

References GetMultiplied().

◆ operator*() [2/2]

CVarMatrix imath::CVarMatrix::operator* ( double value) const
inline

Definition at line 288 of file CVarMatrix.h.

References GetScaled().

◆ operator+()

CVarMatrix imath::CVarMatrix::operator+ ( const CVarMatrix & b) const
inline

Definition at line 248 of file CVarMatrix.h.

References GetAdded().

◆ operator-() [1/2]

CVarMatrix imath::CVarMatrix::operator- ( )
inline

Definition at line 268 of file CVarMatrix.h.

References GetNegated().

◆ operator-() [2/2]

CVarMatrix imath::CVarMatrix::operator- ( const CVarMatrix & b) const
inline

Definition at line 258 of file CVarMatrix.h.

References GetSubstracted().

◆ operator=() [1/2]

CVarMatrix & imath::CVarMatrix::operator= ( const CVarMatrix & array)
default

◆ operator=() [2/2]

CVarMatrix & imath::CVarMatrix::operator= ( CVarMatrix && array)
default

◆ operator==()

bool imath::CVarMatrix::operator== ( const CVarMatrix & matrix) const

◆ Serialize()

bool imath::CVarMatrix::Serialize ( iser::IArchive & archive)

◆ SolveRobustLSP()

static void imath::CVarMatrix::SolveRobustLSP ( CVarMatrix matrixA,
CVarMatrix & matrixY,
CVarMatrix & matrixX,
double minHhNorm = I_BIG_EPSILON )
static

Solve 'Least Square Problem' using robust algorithm.

Solve linear Least Square Problem for equation AX = Y, where A is a {n * m} matrix, X is {m * k} matrix and Y is {n * k} matrix. This implementation solve LSP in place, it transforms internal matrix A into R = HA and matrix Y into Y' = HY. Then it solves equation in form RX = Y', where R is 'quasi' triangle matrix.

Parameters
matrixAinput matrix A in equation AX = Y. It will be destroyed by this operation (triangle matrix R = HA will be calculated in place).
matrixYinput matrix Y in equation AX = Y. It will be destroyed by this operation (matrix Y' = HY will be calculated in place). Please note, that height of this matrix must be the same as height of matrix A.
matrixXresult matrix X in equation AX = Y. It will be initialized be this function. The output size of this matrix will be set to {m * k} where m is width of matrix A and k is height of matrix Y.

◆ TransformR()

bool imath::CVarMatrix::TransformR ( int firstPartWidth)

Transform this matrix in place.

◆ Transpose()

void imath::CVarMatrix::Transpose ( )
inline

Transpose matrix.

Definition at line 238 of file CVarMatrix.h.

References GetTransposed().


The documentation for this class was generated from the following file:

© Witold Gantzke and Kirill Lepskiy