Abstract non Polymorphyc Matrix:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
Mx::Matrix_Sparse< E > Class Template Reference

Chirrisquitica matrix stored as a sparse matrix. More...

#include <Matrix_Sparse.h>

Inheritance diagram for Mx::Matrix_Sparse< E >:
Mx::Matrix_BASE< E >

List of all members.

Public Types

typedef E value_type
 Type of the stored object, similar to the name used in the STL.
typedef value_typereference
 Reference to the stored object, similar to the name used in the STL.
typedef const value_typeconst_reference
 Reference [const] to the stored object, similar to the name used in the STL.

Public Member Functions

 Matrix_Sparse (unsigned m=1, unsigned n=1)
 Constructor de vector.
 Matrix_Sparse (const Matrix_Sparse &o)
 Matrix_Sparse (const E &V)
 Scalar constructor.
 ~Matrix_Sparse ()
 Destructor.
unsigned rows () const
 Number of rows in the matrix.
unsigned cols () const
 Number of columns in the matrix.
unsigned size () const
 Number of values stored in the matrix.
unsigned count () const
 Sinonim of size().
unsigned capacity () const
 Maximum number of values that can be stored in the matrix.
Matrix_Sparseoperator= (const Matrix_Sparse &M)
Matrix_Sparsecopy (const Matrix_Sparse &M)
 Copia desde "o".
Matrix_Sparsemove (Matrix_Sparse &M)
 Traslada el valor de "o" a "*this".
Matrix_Sparseswap (Matrix_Sparse &M)
 Intercambia los valores de "*this" y "o".
void clear ()
 Leaves "*this" with the value the vector constructor initializes it to.
bool equals (const Matrix_Sparse &M) const
E & operator() (unsigned i, unsigned j)
 Retorna una referencia al elemento [i,j] de la matriz.
const E & operator() (unsigned i, unsigned j) const
 Retorna una referencia al elemento [i,j] de la matriz ( const ).
E & at (unsigned i, unsigned j)
 Returns a reference to element [i][j] in the matrix.
const E & at (unsigned i, unsigned j) const
 Returns a const reference to element [i][j] in the matrix [CONST].
void reShape (unsigned m, unsigned n)
 Le ajusta las dimensiones a la matriz.
void reSize (unsigned m, unsigned n)
 Le cambia las dimensiones a la matriz.
void transpose ()
 Transforms the matrix into its transpose.
void setDefault (const E &same)
 Define el escalar que por defecto está en todas las entradas de la Matrix_Sparse.
const E & getDefault ()
 Gets the most common value stored in the matrix.
bool same (const Matrix_BASE &M) const
 Returns true if "M" shares its value with "*this".

Protected Member Functions

Matrix_BASEcopy (const Matrix_BASE &M)
 Copies from "M".
Matrix_BASEmove (Matrix_BASE &M)
 Moves the value from "M" into "*this".
Matrix_BASEswap (Matrix_BASE &M)
 Interchanges the values of "*this" and "M".
bool equals (const Matrix_BASE &M) const
 ¿¿¿ A == B ???

Private Member Functions

void reserve (unsigned _Count)
 Ajusta la matriz para que pueda almacenar n valores diferentes a getDefault().
void reSize (unsigned newsize)
 Le cambia el tamaño máximo posible a la matriz.

Private Attributes

unsigned * m_I
 Indice "i" de M(i,j) 0 <= i < m_capacity
unsigned * m_J
 Indice "j" de M(i,j) 0 <= i < m_capacity
E * m_val
 Valor para M(i,j) 0 <= i < m_capacity
unsigned m_size
 Cantidad de valores insertados en los 3 vectores paralelos.
unsigned m_capacity
 Tamaño de los 3 vectores paralelos.
unsigned m_rows
 Cantidad de filas de la matriz.
unsigned m_cols
 Cantidad de columnas de la matris.
m_same
 Valor almacenado en la mayor parte de la Matrix_Sparse.

Friends

class test_Matrix
 BUnit Test.
template<class T >
bool check_ok (const Matrix_Sparse< T > &M)
 Verifica la invariante de la clase.
template<class T >
void add_Matrix (Matrix_Sparse< T > &Res, const Matrix_Sparse< T > &M)
 Default implementation for operator+( Matrix_BASE<E>&, Matrix_BASE<E> )
template<class MAT >
bool check_ok_Matrix (const MAT &M)
 Generic verification of the class invariant check_ok().
template<class MAT >
bool check_ok_Matrix (const MAT &M)
 Generic verification of the class invariant check_ok().
template<class MAT >
MAT operator+ (const Matrix_BASE< typename MAT::value_type > &A, const MAT &B)
 A+B
template<class MAT >
MAT operator- (const Matrix_BASE< typename MAT::value_type > &A, const MAT &B)
 A-B
template<class MAT >
MAT operator* (const Matrix_BASE< typename MAT::value_type > &A, const MAT &B)
 Res=A*B
template<class MAT >
bool operator== (const Matrix_BASE< typename MAT::value_type > &A, const MAT &B)
 ¿¿¿ (A == B) ???
template<class MAT >
bool operator!= (const Matrix_BASE< typename MAT::value_type > &A, const MAT &B)
 ¿¿¿ (A != B) ???
template<class MAT >
unsigned count_Matrix (const MAT &M)
 Default implementation for Matrix_BASE<E>::count()
template<class MAT >
void clear_Matrix (MAT &M)
 Default implementation for Matrix_BASE<E>::clear()
template<class MAT >
bool equals_Matrix (const MAT &A, const MAT &B)
 Default implementation for Matrix_BASE<E>::operator==()
template<class MAT >
void add_Matrix (MAT &Res, const MAT &M)
 Default implementation for operator+( Matrix_BASE<E>&, Matrix_BASE<E> )
template<class MAT >
void substract_Matrix (MAT &Res, const MAT &M)
 Default implementation for operator-( Matrix_BASE<E>&, Matrix_BASE<E> )
template<class MAT >
void multiply_Matrix (MAT &Res, const MAT &A, const MAT &B)
 Calculates the multiplication A * B and stores the result in "Res".
template<class MAT >
MAT::reference at_Matrix (MAT &M, unsigned i, unsigned j)
 Default implementation for Matrix_BASE<E>::at()
template<class MAT >
MAT::const_reference at_Matrix (const MAT &M, unsigned i, unsigned j)
 Default implementation for Matrix_BASE<E>::at() const.

Detailed Description

template<class E>
class Mx::Matrix_Sparse< E >

Chirrisquitica matrix stored as a sparse matrix.

Definition at line 42 of file Matrix_Sparse.h.


Member Typedef Documentation

template<class E>
Mx::Matrix_BASE< E >::value_type [inherited]

Type of the stored object, similar to the name used in the STL.

Definition at line 47 of file Matrix_BASE.h.

template<class E>
Mx::Matrix_BASE< E >::reference [inherited]

Reference to the stored object, similar to the name used in the STL.

Definition at line 48 of file Matrix_BASE.h.

template<class E>
Mx::Matrix_BASE< E >::const_reference [inherited]

Reference [const] to the stored object, similar to the name used in the STL.

Definition at line 49 of file Matrix_BASE.h.


Constructor & Destructor Documentation

template<class E >
Mx::Matrix_Sparse< E >::Matrix_Sparse ( unsigned  m = 1,
unsigned  n = 1 
) [inline]

Constructor de vector.

  • Obtiene suficiente memoria dinámica para almacenas los n * m valores de la matriz.
  • Si "value_type" tiene un constructor de vector, lo usar para inicializar cada uno de los valores de la matriz; de lo contrario, los deja tal cual están en la memoria.
  • Si "value_type" es uno de los tipos escalares básicos, como lo son int o float, los valores almacenados en la matriz quedan tal cual están y no son inicializados.
    Precondition:
    • m * n > 0
    • (m > 0) && (n > 0)

Definition at line 225 of file Matrix_Sparse.h.

template<class E >
Mx::Matrix_Sparse< E >::Matrix_Sparse ( const Matrix_Sparse< E > &  o) [inline]

Definition at line 245 of file Matrix_Sparse.h.

template<class E>
Mx::Matrix_Sparse< E >::Matrix_Sparse ( const E &  V) [inline]

Scalar constructor.

  • The matrix is scalar with dimension 1x1 and value "V".

Definition at line 47 of file Matrix_Sparse.h.

template<class E >
Mx::Matrix_Sparse< E >::~Matrix_Sparse ( ) [inline]

Destructor.

Definition at line 266 of file Matrix_Sparse.h.


Member Function Documentation

template<class E>
unsigned Mx::Matrix_Sparse< E >::rows ( ) const [inline]

Number of rows in the matrix.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 51 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::cols ( ) const [inline]

Number of columns in the matrix.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 52 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::size ( ) const [inline]

Number of values stored in the matrix.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 53 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::count ( ) const [inline]

Sinonim of size().

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 54 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::capacity ( ) const [inline]

Maximum number of values that can be stored in the matrix.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 55 of file Matrix_Sparse.h.

template<class E>
Matrix_Sparse& Mx::Matrix_Sparse< E >::operator= ( const Matrix_Sparse< E > &  M) [inline]

Definition at line 57 of file Matrix_Sparse.h.

template<class E >
Matrix_Sparse< E > & Mx::Matrix_Sparse< E >::copy ( const Matrix_Sparse< E > &  M)

Copia desde "o".

  • Copia todo el valor de "o" sobre "*this", de forma que el nuevo valor de "*this" sea un duplicado exacto del valor de "o".
  • El valor anterior de "*this" se pierde.
  • El objeto "o" mantiene su valor anterior.
  • Luego de la copia, cuando el valor de "o" cambia, el de "*this" no cambiará, y viceversa, pues la copia es una copia profunda; no es superficial.
  • Si "*this" es "o" entonces su valor no cambia.
  • Después de esta operación siempre ocurre que *this == o .
Complejidad:
O( rows() * cols() )
Returns:
*this
See also:
http://www.di-mare.com/adolfo/binder/c04.htm#sc05

Definition at line 291 of file Matrix_Sparse.h.

template<class E >
Matrix_Sparse< E > & Mx::Matrix_Sparse< E >::move ( Matrix_Sparse< E > &  M)

Traslada el valor de "o" a "*this".

  • El valor anterior de "*this" se pierde.
  • El nuevo valor de "*this" es el que "o" tuvo.
  • "o" queda en el estado en que lo dejaría Erase().
  • Si "*this" es "o" entonces su valor no cambia.
  • En general, después de esta operación casi nunca ocurre que (*this == o)

    Complejidad:
    O( rows() * cols() )
    Returns:
    *this
    See also:
    http://www.di-mare.com/adolfo/binder/c04.htm#sc07

Definition at line 353 of file Matrix_Sparse.h.

template<class E >
Matrix_Sparse< E > & Mx::Matrix_Sparse< E >::swap ( Matrix_Sparse< E > &  M)

Intercambia los valores de "*this" y "o".

  • Debido a que algunos métodos retornan copias del valor de "*this" en lugar de una referencia, como ocurre con Matrix_Sparse::Child(), a veces swap() no tiene el resultado esperado por el programador.
  • Por ejemplo, si se invoca T.Child(i). swap( T.Child(j) ) el resultado no es intercambiar los hijos, sino más bien intercambiar los valores de los sub-árboles temporales T.Child(i) y T.Child(j). La forma correcta de intercambiar hijos es usar Graft().

    Complejidad:
    O( 1 )
    Returns:
    *this
    See also:
    http://www.di-mare.com/adolfo/binder/c04.htm#sc08

Definition at line 392 of file Matrix_Sparse.h.

template<class E>
void Mx::Matrix_Sparse< E >::clear ( ) [inline]

Leaves "*this" with the value the vector constructor initializes it to.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 61 of file Matrix_Sparse.h.

template<class E>
bool Mx::Matrix_Sparse< E >::equals ( const Matrix_Sparse< E > &  M) const [inline]

Definition at line 63 of file Matrix_Sparse.h.

template<class E >
E & Mx::Matrix_Sparse< E >::operator() ( unsigned  i,
unsigned  j 
) [inline]

Retorna una referencia al elemento [i,j] de la matriz.

  • M(i,j) significa lo que en arreglos se denota con M[i][j].
  • M(i,j) = val; // M(i,j) es un "lvalue" (modificable)

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 587 of file Matrix_Sparse.h.

template<class E >
const E & Mx::Matrix_Sparse< E >::operator() ( unsigned  i,
unsigned  j 
) const [inline]

Retorna una referencia al elemento [i,j] de la matriz ( const ).

  • M(i,j) significa lo que en arreglos se denota con M[i][j].
  • val = M(i,j); // M(i,j) es un "rvalue" (const)

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 525 of file Matrix_Sparse.h.

template<class E>
E& Mx::Matrix_Sparse< E >::at ( unsigned  i,
unsigned  j 
) [inline]

Returns a reference to element [i][j] in the matrix.

  • Verifyes that a value with indexes [i][j] exists in the matrix.
  • If [i][j] is out of range throws exception std::out_of_range.
  • This reference allows modifying the stored value.
  • M.at(i,j) = val; // M.at(i,j) is un "lvalue" (mutable)

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 68 of file Matrix_Sparse.h.

template<class E>
const E& Mx::Matrix_Sparse< E >::at ( unsigned  i,
unsigned  j 
) const [inline]

Returns a const reference to element [i][j] in the matrix [CONST].

  • Verifyes that a value with indexes [i][j] exists in the matrix.
  • If [i][j] is out of range throws exception std::out_of_range.
  • This reference only allows reading the stored value.
  • val = M.at(i,j); // M.at(i,j) is a "rvalue" (const)

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 70 of file Matrix_Sparse.h.

template<class E >
void Mx::Matrix_Sparse< E >::reShape ( unsigned  m,
unsigned  n 
) [inline]

Le ajusta las dimensiones a la matriz.

  • Si ocurre que (m*n) == rows()*cols() hace lo mismo que haría reSize(m,n).
  • En caso contrario, no hace nada.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 515 of file Matrix_Sparse.h.

template<class E >
void Mx::Matrix_Sparse< E >::reSize ( unsigned  m,
unsigned  n 
)

Le cambia las dimensiones a la matriz.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 410 of file Matrix_Sparse.h.

template<class E>
void Mx::Matrix_Sparse< E >::transpose ( )

Transforms the matrix into its transpose.

Reimplemented from Mx::Matrix_BASE< E >.

template<class E >
void Mx::Matrix_Sparse< E >::setDefault ( const E &  same) [inline]

Define el escalar que por defecto está en todas las entradas de la Matrix_Sparse.

  • Si same != getDefault() la matriz queda vacía.
  • De lo contrario, nada ocurre.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 204 of file Matrix_Sparse.h.

template<class E>
const E& Mx::Matrix_Sparse< E >::getDefault ( ) [inline]

Gets the most common value stored in the matrix.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 78 of file Matrix_Sparse.h.

template<class E>
void Mx::Matrix_Sparse< E >::reserve ( unsigned  _Count) [private]

Ajusta la matriz para que pueda almacenar n valores diferentes a getDefault().

template<class E >
void Mx::Matrix_Sparse< E >::reSize ( unsigned  newsize) [private]

Le cambia el tamaño máximo posible a la matriz.

  • Le aumenta la cantidad de valores diferentes a getDefault().
  • No hace nada cuando size() < newsize.

Definition at line 626 of file Matrix_Sparse.h.

template<class E>
Matrix_BASE< E > & Mx::Matrix_BASE< E >::copy ( const Matrix_BASE< E > &  M) [protected, inherited]

Copies from "M".

  • Copies the whole value from "M" into "*this" in such a way that the new valuer for "*this" is an exact duplicate of the value in "M".
  • The previous value stored in "*this" is lost.
  • Object "M" maintains its value.
  • After the copy, when the value for "M" changes, the value for "*this" will not change, and viceversa, because the copy is a deep copy; it is not supperficial.
  • If "*this" is "M" its value will not change.
  • After this operation it is always true that *this == M .
Returns:
"*this"
See also:
http://www.di-mare.com/adolfo/binder/c04.htm#sc05
template<class E>
Matrix_BASE< E > & Mx::Matrix_BASE< E >::move ( Matrix_BASE< E > &  M) [protected, inherited]

Moves the value from "M" into "*this".

  • The previous value stored in "*this" is lost.
  • The new value for "*this" is what was stored in "M".
  • "M" remains in the state an object will have after being initialized by the vector contructor.
  • If "*this" is "M" its value will not change.
  • In general, after this operation, it will almost never ocurr that (*this == M) .
Returns:
"*this"
See also:
http://www.di-mare.com/adolfo/binder/c04.htm#sc07
template<class E>
Matrix_BASE< E > & Mx::Matrix_BASE< E >::swap ( Matrix_BASE< E > &  M) [protected, inherited]

Interchanges the values of "*this" and "M".

  • In many ocations this operation takes less time than copy() or move().
Returns:
"*this"
See also:
http://www.di-mare.com/adolfo/binder/c04.htm#sc08
template<class E>
bool Mx::Matrix_BASE< E >::same ( const Matrix_BASE< E > &  M) const [inline, inherited]

Returns true if "M" shares its value with "*this".

Definition at line 68 of file Matrix_BASE.h.

template<class E>
bool Mx::Matrix_BASE< E >::equals ( const Matrix_BASE< E > &  M) const [protected, inherited]

¿¿¿ A == B ???


Friends And Related Function Documentation

template<class E>
friend class test_Matrix [friend]

BUnit Test.

Reimplemented from Mx::Matrix_BASE< E >.

Definition at line 81 of file Matrix_Sparse.h.

template<class E>
template<class T >
bool check_ok ( const Matrix_Sparse< T > &  M) [friend]

Verifica la invariante de la clase.

- El campo \c m_same indica cuál es el valor que se repite más en toda la matriz.
- Usualmente \c same es el neutro aditivo \c value_type().
- No existe un constructor explícito para darle a \c m_same su valor inicial, que
  es siempre inicializado en \c value_type(). Para cambiarlo es necesario invocar
  el método \c setgetDefault().
- Los vectores \c m_I[], \c m_J[] y \c m_val[] son vectores paralelos, todos de
  longitud \c Matrix_Sparse::m_capacity.
- La cantidad máxima de valores diferente que pueden ser almacenados en la matriz
  es \c Matrix_Sparse::m_capacity.
- El largo de estos vectores aumenta cuando se hace referencia a un valor M(i,j)
  mediante la versión que no es \c const del \c operator()(i,j). O sea, que es
  ese método el encargado de agregar valores en \c m_val[], pues el operador
  homónimo \c const operator()(i,j) nunca agrega nada y, como es \c const, en
  general retorna una referencia constante a \c m_same.
- Es posible que la matriz tenga dimensiones nulas, lo que implica que todos los
  punteros a los vectors paralelos deben ser nulos. Este hecho se marca dándolo
  el valor \c 0 (cero) al campo \c m_capacity.
- En todos los algoritmos, "m" o "m_rows" es la cantidad de filas == \c rows()
- En todos los algoritmos, "n" o "m_cols" es la cantidad de columnas == \c cols()

\par <em>Rep</em> Modelo de la clase
         ____________________________________
        /          m_capacity                \
        +---+---+---+---+---+---+-..-+---+---+       0 1 2 3 4 5 6
 m_I--->| 1 | 3 | 3 |'-'| ...       ...  |'-'|   0 / - - - - - - - \
        +---+---+---+---+ ...       ...  +---+   1 | - a - - - - - |
 m_J--->| 1 | 2 | 1 |'-'| ...       ...  |'-'|   2 | - - - - - - - |
        +---+---+---+---+ ...       ...  +---+   3 | - c b - - - - |
m_val-->|'a'|'b'|'c'|'-'| ...       ...  |'-'|   4 \ - - - - - - - /
        +---+---+---+---+---+---+-..-+---+---+
          0   1   2   |
        m_size--------+ == 3    m_same == '-'   m_rows == 5  m_cols == 7
  • check_ok(): ( (0<=m_I[k]) && (m_I[k] < m_rows) ) k = [0..m_size-1]
  • check_ok(): ( (0<=m_J[k]) && (m_J[k] < m_cols) ) k = [0..m_size-1]

Definition at line 141 of file Matrix_Sparse.h.

template<class E>
template<class T >
void add_Matrix ( Matrix_Sparse< T > &  Res,
const Matrix_Sparse< T > &  M 
) [friend]

Default implementation for operator+( Matrix_BASE<E>&, Matrix_BASE<E> )

Precondition:
  • "*this" y "M" must have the same dimentions.
  • rows() == M.rows() && cols() == M.cols() .
Remarks:
  • This is the implementation for Matrix_BASE<E> operator+( Matrix_BASE<E>&, Matrix_BASE<E> ) .
  • The compiler has problems compiling a friend function ("friend") defined with templates if that friend function is not defined (implemented) within the class declaration. To overcome this deficiency there exists this function that does the work, although it is not convenient to use.

Definition at line 652 of file Matrix_Sparse.h.

template<class E>
template<class MAT >
bool check_ok_Matrix ( const MAT &  M) [friend, inherited]

Generic verification of the class invariant check_ok().

Remarks:
Releaves the programner form implementing method Ok()
  • check_ok(): (M.rows() == 0) <==> (M.cols() == 0)

Definition at line 140 of file Matrix_BASE.h.

template<class E>
template<class MAT >
bool check_ok_Matrix ( const MAT &  M) [friend, inherited]

Generic verification of the class invariant check_ok().

Remarks:
Releaves the programner form implementing method Ok()
  • check_ok(): (M.rows() == 0) <==> (M.cols() == 0)

Definition at line 140 of file Matrix_BASE.h.

template<class E>
template<class MAT >
MAT operator+ ( const Matrix_BASE< typename MAT::value_type > &  A,
const MAT &  B 
) [friend, inherited]

A+B

Definition at line 368 of file Matrix_BASE.h.

template<class E>
template<class MAT >
MAT operator- ( const Matrix_BASE< typename MAT::value_type > &  A,
const MAT &  B 
) [friend, inherited]

A-B

Definition at line 448 of file Matrix_BASE.h.

template<class E>
template<class MAT >
MAT operator* ( const Matrix_BASE< typename MAT::value_type > &  A,
const MAT &  B 
) [friend, inherited]

Res=A*B

Definition at line 454 of file Matrix_BASE.h.

template<class E>
template<class MAT >
bool operator== ( const Matrix_BASE< typename MAT::value_type > &  A,
const MAT &  B 
) [friend, inherited]

¿¿¿ (A == B) ???

Definition at line 460 of file Matrix_BASE.h.

template<class E>
template<class MAT >
bool operator!= ( const Matrix_BASE< typename MAT::value_type > &  A,
const MAT &  B 
) [friend, inherited]

¿¿¿ (A != B) ???

Definition at line 466 of file Matrix_BASE.h.

template<class E>
template<class MAT >
unsigned count_Matrix ( const MAT &  M) [friend, inherited]

Default implementation for Matrix_BASE<E>::count()

Definition at line 167 of file Matrix_BASE.h.

template<class E>
template<class MAT >
void clear_Matrix ( MAT &  M) [friend, inherited]

Default implementation for Matrix_BASE<E>::clear()

Definition at line 178 of file Matrix_BASE.h.

template<class E>
template<class MAT >
bool equals_Matrix ( const MAT &  A,
const MAT &  B 
) [friend, inherited]

Default implementation for Matrix_BASE<E>::operator==()

Definition at line 190 of file Matrix_BASE.h.

template<class E>
template<class MAT >
void add_Matrix ( MAT &  Res,
const MAT &  M 
) [friend, inherited]

Default implementation for operator+( Matrix_BASE<E>&, Matrix_BASE<E> )

Precondition:
  • "*this" y "M" must have the same dimentions.
  • rows() == M.rows() && cols() == M.cols() .
Remarks:
  • This is the implementation for Matrix_BASE<E> operator+( Matrix_BASE<E>&, Matrix_BASE<E> ) .
  • The compiler has problems compiling a friend function ("friend") defined with templates if that friend function is not defined (implemented) within the class declaration. To overcome this deficiency there exists this function that does the work, although it is not convenient to use.

Definition at line 239 of file Matrix_BASE.h.

template<class E>
template<class MAT >
void substract_Matrix ( MAT &  Res,
const MAT &  M 
) [friend, inherited]

Default implementation for operator-( Matrix_BASE<E>&, Matrix_BASE<E> )

Definition at line 259 of file Matrix_BASE.h.

template<class E>
template<class MAT >
void multiply_Matrix ( MAT &  Res,
const MAT &  A,
const MAT &  B 
) [friend, inherited]

Calculates the multiplication A * B and stores the result in "Res".

  • The dimensions for "*this" get adjusted such that:
    Res.rows() == A.rows() && Res.cols() == B.cols()
  • This is the implementation for Matrix_BASE<E> operator*() .
Precondition:
  • "A" y "B" must have compatible dimensions.
  • A.cols() == B.rows() .
  • The multiplication is carried out [Row x Column], which means that the number of valies in the rows for "A" must be equal to the number of columns of "B".
Complexity:
O( A.cols() * B.cols() * A.cols() )

Definition at line 307 of file Matrix_BASE.h.

template<class E>
template<class MAT >
MAT::reference at_Matrix ( MAT &  M,
unsigned  i,
unsigned  j 
) [friend, inherited]

Default implementation for Matrix_BASE<E>::at()

Definition at line 335 of file Matrix_BASE.h.

template<class E>
template<class MAT >
MAT::const_reference at_Matrix ( const MAT &  M,
unsigned  i,
unsigned  j 
) [friend, inherited]

Default implementation for Matrix_BASE<E>::at() const.

Definition at line 354 of file Matrix_BASE.h.


Member Data Documentation

template<class E>
unsigned* Mx::Matrix_Sparse< E >::m_I [private]

Indice "i" de M(i,j) 0 <= i < m_capacity

Definition at line 87 of file Matrix_Sparse.h.

template<class E>
unsigned* Mx::Matrix_Sparse< E >::m_J [private]

Indice "j" de M(i,j) 0 <= i < m_capacity

Definition at line 88 of file Matrix_Sparse.h.

template<class E>
E* Mx::Matrix_Sparse< E >::m_val [private]

Valor para M(i,j) 0 <= i < m_capacity

Definition at line 89 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::m_size [private]

Cantidad de valores insertados en los 3 vectores paralelos.

Definition at line 90 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::m_capacity [private]

Tamaño de los 3 vectores paralelos.

Definition at line 91 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::m_rows [private]

Cantidad de filas de la matriz.

Definition at line 92 of file Matrix_Sparse.h.

template<class E>
unsigned Mx::Matrix_Sparse< E >::m_cols [private]

Cantidad de columnas de la matris.

Definition at line 93 of file Matrix_Sparse.h.

template<class E>
E Mx::Matrix_Sparse< E >::m_same [private]

Valor almacenado en la mayor parte de la Matrix_Sparse.

Definition at line 94 of file Matrix_Sparse.h.


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