| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Friends
TeMatrix Class Reference

This class represents a matrix of elements of type double. More...

`#include <TeMatrix.h>`

List of all members.

## Public Member Functions

| TeMatrix ()
| Normal constructor.
| TeMatrix (const TeMatrix &)
| Copy constructor.
| ~TeMatrix ()
| Destructor.
void | Clear ()
| Clear memory for matrix.
int | Initialized ()
| Checks if the matrix is initialized.
int | Init (int nrow=1, int ncol=1, double *f=0)
| Initializes the matrix with a vector of values.
int | Init (int nrow, int ncol, double f)
| Initializes the matrix with the same value.
int | Init (int k, double *f)
| Diagonal matrix with different values.
int | Init (int k, double f)
| Diagonal matrix with the same value.
const double & | operator() (int lin, int col) const
| Acess element in position (lin,col)
double & | operator() (int lin, int col)
| Acess element in position (lin,col)
double const *const | operator[] (int lin) const
| Direct line pointer const access.
double * | operator[] (int lin)
| Direct line pointer access.
TeMatrix & | operator= (const TeMatrix &m)
| Assign matrix values to another one using operator =.
int | operator== (const TeMatrix &m) const
| Compares two matrix using the operator ==.
void | operator*= (double)
| Operator *=.
TeMatrix | operator- ()
| Operator unary minus.
int | Nrow () const
| Returns the number of rows.
int | Ncol () const
| Returns the number of columns.
void | Print () const
| Print the matrix elements .
void | switchRows (int a, int b)
| Switches two rows "a" and "b".
void | combineRows (int i, double b, int j)
| Combines two rows in according to row(i) += b*row(j)
int | Transpose (TeMatrix &mt) const
| Finds the transpose of a matrix.
int | Inverse (TeMatrix &mt) const
| Finds the inverse of a matrix, if any.
int | CholeskyInv (TeMatrix &mt) const
| Finds the inverse of a triangle matrix acquired from Cholesky decomposition.
int | MatTransf (TeMatrix &mt)
| Calculates the inverse of a lowertriangle matrix aquired from the Cholesky decomposition of a simetric positive definide matrix.
int | isUpperTriangle () const
| Checks if the matrix is an uppertriangle matrix.
int | isLowerTriangle () const
| Checks if the matrix is an lowertriangle matrix.
int | isSimetric () const
| Checks if the matrix is a simetric matrix.
int | isPositiveDefinide () const
| Checks if the matrix is positive definide.
int | CoFactor (int irow, int jcol, TeMatrix &m) const
| Calculates the cofactor value of a matrix.
double | Determinant () const
| Calculates the determinant value.
int | CholeskyDecomp (TeMatrix &mt)
int | EigenVectors (TeMatrix &mt) const
| Calculates the EigenVectors.
int | EigenValues (TeMatrix &mt) const
| Calculates the EigenValues.
int | EigenVec (double e_vec[])
| Calculates the EigenVectors.
double | getTrace () const
| Matrix trace calcule (the sum of diagonal elements).
bool | getPinv (TeMatrix &pinv) const
| Build the pseudo-inverse from this matrix.
bool | getSVD (TeMatrix &UMtx, TeMatrix &DMtx, TeMatrix &VMtx) const
| Singular value decomposition (SVD) from this matrix (A).

## Static Public Member Functions

static bool | getIdentity (TeMatrix &identity, unsigned int width)
| Generate a identity matrix .
static bool | getProduct (const TeMatrix &matrix1, const TeMatrix &matrix2, TeMatrix &productMatrix)
| Generate the product of two matrixes.

## Friends

TL_DLL TeMatrix | operator+ (const TeMatrix &m1, const TeMatrix &m2)
| Sums two matrices.
TL_DLL TeMatrix | operator- (const TeMatrix &, const TeMatrix &)
| Subtracts two matrices.
TL_DLL TeMatrix | operator* (const TeMatrix &, const TeMatrix &)
| Calculates the product of two matrices.
TL_DLL TeMatrix | operator* (double c, const TeMatrix &)
| Product of the matrix by a constant.

## Detailed Description

This class represents a matrix of elements of type double.

Examples:

  TePDIPrincipalComponents_test.cpp, and TePDIStatistic_test.cpp.

## Constructor & Destructor Documentation

TeMatrix::TeMatrix | ( |  | ) |

Normal constructor.

TeMatrix::TeMatrix | ( | const TeMatrix & | m | ) |

Copy constructor.

TeMatrix::~TeMatrix | ( |  | ) |

Destructor.

## Member Function Documentation

int TeMatrix::CholeskyDecomp | ( | TeMatrix & | mt | ) |

int TeMatrix::CholeskyInv | ( | TeMatrix & | mt | ) | const

Finds the inverse of a triangle matrix acquired from Cholesky decomposition.

void TeMatrix::Clear | ( | void |  | ) |

Clear memory for matrix.

int TeMatrix::CoFactor | ( | int | irow,
|  | int | jcol,
|  | TeMatrix & | m
| ) |  | const

Calculates the cofactor value of a matrix.

void TeMatrix::combineRows | ( | int | i,
|  | double | b,
|  | int | j
| ) |  |

Combines two rows in according to row(i) += b*row(j)

double TeMatrix::Determinant | ( |  | ) | const

Calculates the determinant value.

int TeMatrix::EigenValues | ( | TeMatrix & | mt | ) | const

Calculates the EigenValues.

int TeMatrix::EigenVec | ( | double | e_vec[] | ) |

Calculates the EigenVectors.

int TeMatrix::EigenVectors | ( | TeMatrix & | mt | ) | const

Calculates the EigenVectors.

bool TeMatrix::getIdentity | ( | TeMatrix & | identity,
|  | unsigned int | width
| ) |  | `[static]`

Generate a identity matrix .

Parameters:

  identity | The generated identity matrix.
  width | The identity matrix width.

Returns:
  true if OK, false on errors.

bool TeMatrix::getPinv | ( | TeMatrix & | pinv | ) | const

Build the pseudo-inverse from this matrix.

Note:
  PinvX = Inv( Xt * X ) * Xt, where Inv=Inverse and Xt is the transposed matrix of X.

Returns:
  true if OK, false on errors.

bool TeMatrix::getProduct | ( | const TeMatrix & | matrix1,
|  | const TeMatrix & | matrix2,
|  | TeMatrix & | productMatrix
| ) |  | `[static]`

Generate the product of two matrixes.

Note:
  product = matrix1 * matrix2

Parameters:

  matrix1 | Input matrix 1.
  matrix2 | Input matrix 2.
  productMatrix | Output product matrix.

Returns:
  true if OK, false on errors.

bool TeMatrix::getSVD | ( | TeMatrix & | UMtx,
|  | TeMatrix & | DMtx,
|  | TeMatrix & | VMtx
| ) |  | const

Singular value decomposition (SVD) from this matrix (A).

Note:
  A = U . D . Vt, where U is a MxM orthogonal matrix, D is a MxN diagonal matrix and V is NxN orthogonal matrix.

Returns:
  true if OK, false on errors.

double TeMatrix::getTrace | ( |  | ) | const

Matrix trace calcule (the sum of diagonal elements).

Returns:
  The matrix trace.

int TeMatrix::Init | ( | int | nrow,
|  | int | ncol,
|  | double | f
| ) |  |

Initializes the matrix with the same value.

int TeMatrix::Init | ( | int | k,
|  | double * | f
| ) |  |

Diagonal matrix with different values.

int TeMatrix::Init | ( | int | k,
|  | double | f
| ) |  |

Diagonal matrix with the same value.

int TeMatrix::Init | ( | int | nrow = `1`,
|  | int | ncol = `1`,
|  | double * | f = `0`
| ) |  |

Initializes the matrix with a vector of values.

Examples:
  TePDIBlender_test.cpp.

int TeMatrix::Initialized | ( |  | ) | `[inline]`

Checks if the matrix is initialized.

int TeMatrix::Inverse | ( | TeMatrix & | mt | ) | const

Finds the inverse of a matrix, if any.

int TeMatrix::isLowerTriangle | ( |  | ) | const

Checks if the matrix is an lowertriangle matrix.

int TeMatrix::isPositiveDefinide | ( |  | ) | const

Checks if the matrix is positive definide.

int TeMatrix::isSimetric | ( |  | ) | const

Checks if the matrix is a simetric matrix.

int TeMatrix::isUpperTriangle | ( |  | ) | const

Checks if the matrix is an uppertriangle matrix.

int TeMatrix::MatTransf | ( | TeMatrix & | mt | ) |

Calculates the inverse of a lowertriangle matrix aquired from the Cholesky decomposition of a simetric positive definide matrix.

int TeMatrix::Ncol | ( |  | ) | const`[inline]`

Returns the number of columns.

int TeMatrix::Nrow | ( |  | ) | const`[inline]`

Returns the number of rows.

double& TeMatrix::operator() | ( | int | lin,
|  | int | col
| ) |  | `[inline]`

Acess element in position (lin,col)

const double& TeMatrix::operator() | ( | int | lin,
|  | int | col
| ) |  | const`[inline]`

Acess element in position (lin,col)

void TeMatrix::operator*= | ( | double | f | ) |

Operator *=.

TeMatrix TeMatrix::operator- | ( |  | ) |

Operator unary minus.

TeMatrix & TeMatrix::operator= | ( | const TeMatrix & | m | ) |

Assign matrix values to another one using operator =.

int TeMatrix::operator== | ( | const TeMatrix & | m | ) | const

Compares two matrix using the operator ==.

double const* const TeMatrix::operator[] | ( | int | lin | ) | const`[inline]`

Direct line pointer const access.

Parameters:

  lin | A valid line number.

Returns:
  The required line pointer.

double* TeMatrix::operator[] | ( | int | lin | ) | `[inline]`

Direct line pointer access.

Parameters:

  lin | A valid line number.

Returns:
  The required line pointer.

void TeMatrix::Print | ( |  | ) | const

Print the matrix elements .

void TeMatrix::switchRows | ( | int | a,
|  | int | b
| ) |  |

Switches two rows "a" and "b".

int TeMatrix::Transpose | ( | TeMatrix & | mt | ) | const

Finds the transpose of a matrix.

## Friends And Related Function Documentation

TL_DLL TeMatrix operator* | ( | const TeMatrix & | m,
|  | const TeMatrix & | n
| ) |  | `[friend]`

Calculates the product of two matrices.

TL_DLL TeMatrix operator* | ( | double | c,
|  | const TeMatrix & | m
| ) |  | `[friend]`

Product of the matrix by a constant.

TL_DLL TeMatrix operator+ | ( | const TeMatrix & | m1,
|  | const TeMatrix & | m2
| ) |  | `[friend]`

Sums two matrices.

TL_DLL TeMatrix operator- | ( | const TeMatrix & | m,
|  | const TeMatrix & | n
| ) |  | `[friend]`

Subtracts two matrices.

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeMatrix.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeMatrix.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines