Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

fl::Matrix< T > Class Template Reference

#include <matrix.h>

Inheritance diagram for fl::Matrix< T >:

fl::MatrixAbstract< T > fl::Vector< T > List of all members.

Public Methods

 Matrix ()
 Matrix (const int rows, const int columns=1)
 Matrix (const MatrixAbstract< T > &that)
template<class T2>  Matrix (const MatrixAbstract< T2 > &that)
 Matrix (std::istream &stream)
 Matrix (T *that, const int rows, const int columns=1)
 Attach to memory block pointed to by that.

 Matrix (Pointer &that, const int rows=-1, const int columns=1)
 Share memory block with that. rows == -1 or columns == -1 means infer number from size of memory. At least one of {rows, columns} must be positive.

virtual ~Matrix ()
void detach ()
 Set the state of this matrix as if it has no data. Releases (but only frees if appropriate) any memory.

virtual T & operator() (const int row, const int column) const
 Element accesss.

virtual T & operator[] (const int row) const
 Element access, treating us as a vector.

virtual int rows () const
virtual int columns () const
virtual MatrixAbstract< T > * duplicate () const
 Make a new instance of self on the heap, with shallow copy semantics. Used for views. Since this is class sensitive, it must be overridden.

virtual void clear (const T scalar=(T) 0)
 Set all elements to given value.

virtual void resize (const int rows, const int columns=1)
 Change number of rows and columns. Does not preserve data.

virtual void copyFrom (const Matrix< T > &that)
virtual Matrix reshape (const int rows, const int columns=1) const
virtual T frob (T n) const
 Generalized Frobenius norm: (sum_elements (element^n))^(1/n). Effectively: INFINITY is max, 1 is sum, 2 is standard Frobenius norm.

virtual T sumSquares () const
 Similar to frob(2), but without taking the square root.

virtual T dot (const Matrix &B) const
virtual Matrix transposeSquare () const
 Computes the upper triangular part of the symmetric matrix (~this * this).

virtual MatrixTranspose< T > operator~ () const
virtual Matrix operator * (const MatrixAbstract< T > &B) const
virtual Matrix operator * (const Matrix &B) const
virtual Matrix operator * (const T scalar) const
virtual Matrix operator/ (const T scalar) const
virtual Matrix operator+ (const Matrix &B) const
virtual Matrix operator- (const Matrix &B) const
virtual Matrix & operator *= (const Matrix &B)
virtual MatrixAbstract< T > & operator *= (const T scalar)
 this = this * scalar

virtual MatrixAbstract< T > & operator/= (const T scalar)
 this = this / scalar

virtual Matrix & operator+= (const Matrix &B)
virtual Matrix & operator-= (const Matrix &B)
virtual MatrixAbstract< T > & operator-= (const T scalar)
 Decrease each element by scalar.

virtual void read (std::istream &stream)
virtual void write (std::ostream &stream, bool withName=false) const

Public Attributes

Pointer data
int rows_
int columns_

template<class T>
class fl::Matrix< T >


Constructor & Destructor Documentation

template<class T>
fl::Matrix< T >::Matrix  
 

template<class T>
fl::Matrix< T >::Matrix const int    rows,
const int    columns = 1
 

template<class T>
fl::Matrix< T >::Matrix const MatrixAbstract< T > &    that
 

template<class T>
template<class T2>
fl::Matrix< T >::Matrix const MatrixAbstract< T2 > &    that [inline]
 

template<class T>
fl::Matrix< T >::Matrix std::istream &    stream
 

template<class T>
fl::Matrix< T >::Matrix T *    that,
const int    rows,
const int    columns = 1
 

Attach to memory block pointed to by that.

template<class T>
fl::Matrix< T >::Matrix Pointer   that,
const int    rows = -1,
const int    columns = 1
 

Share memory block with that. rows == -1 or columns == -1 means infer number from size of memory. At least one of {rows, columns} must be positive.

template<class T>
fl::Matrix< T >::~Matrix   [virtual]
 


Member Function Documentation

template<class T>
void fl::Matrix< T >::clear const T    scalar = (T) 0 [virtual]
 

Set all elements to given value.

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
int fl::Matrix< T >::columns   [virtual]
 

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
void fl::Matrix< T >::copyFrom const Matrix< T > &    that [virtual]
 

template<class T>
void fl::Matrix< T >::detach  
 

Set the state of this matrix as if it has no data. Releases (but only frees if appropriate) any memory.

template<class T>
T fl::Matrix< T >::dot const Matrix< T > &    B const [virtual]
 

template<class T>
MatrixAbstract< T > * fl::Matrix< T >::duplicate   [virtual]
 

Make a new instance of self on the heap, with shallow copy semantics. Used for views. Since this is class sensitive, it must be overridden.

Implements fl::MatrixAbstract< T >.

Reimplemented in fl::Vector< T >, and fl::Vector< float >.

template<class T>
T fl::Matrix< T >::frob   n const [virtual]
 

Generalized Frobenius norm: (sum_elements (element^n))^(1/n). Effectively: INFINITY is max, 1 is sum, 2 is standard Frobenius norm.

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
Matrix< T > fl::Matrix< T >::operator * const T    scalar const [virtual]
 

template<class T>
Matrix< T > fl::Matrix< T >::operator * const Matrix< T > &    B const [virtual]
 

template<class T>
Matrix< T > fl::Matrix< T >::operator * const MatrixAbstract< T > &    B const [virtual]
 

template<class T>
MatrixAbstract< T > & fl::Matrix< T >::operator *= const T    scalar [virtual]
 

this = this * scalar

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
Matrix< T > & fl::Matrix< T >::operator *= const Matrix< T > &    B [virtual]
 

template<class T>
virtual T& fl::Matrix< T >::operator() const int    row,
const int    column
const [inline, virtual]
 

Element accesss.

Implements fl::MatrixAbstract< T >.

template<class T>
Matrix< T > fl::Matrix< T >::operator+ const Matrix< T > &    B const [virtual]
 

template<class T>
Matrix< T > & fl::Matrix< T >::operator+= const Matrix< T > &    B [virtual]
 

template<class T>
Matrix< T > fl::Matrix< T >::operator- const Matrix< T > &    B const [virtual]
 

template<class T>
MatrixAbstract< T > & fl::Matrix< T >::operator-= const T    scalar [virtual]
 

Decrease each element by scalar.

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
Matrix< T > & fl::Matrix< T >::operator-= const Matrix< T > &    B [virtual]
 

template<class T>
Matrix< T > fl::Matrix< T >::operator/ const T    scalar const [virtual]
 

template<class T>
MatrixAbstract< T > & fl::Matrix< T >::operator/= const T    scalar [virtual]
 

this = this / scalar

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
virtual T& fl::Matrix< T >::operator[] const int    row const [inline, virtual]
 

Element access, treating us as a vector.

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
MatrixTranspose< T > fl::Matrix< T >::operator~   [virtual]
 

template<class T>
void fl::Matrix< T >::read std::istream &    stream [virtual]
 

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
Matrix< T > fl::Matrix< T >::reshape const int    rows,
const int    columns = 1
const [virtual]
 

template<class T>
void fl::Matrix< T >::resize const int    rows,
const int    columns = 1
[virtual]
 

Change number of rows and columns. Does not preserve data.

Implements fl::MatrixAbstract< T >.

Reimplemented in fl::Vector< T >, and fl::Vector< float >.

template<class T>
int fl::Matrix< T >::rows   [virtual]
 

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
T fl::Matrix< T >::sumSquares   [virtual]
 

Similar to frob(2), but without taking the square root.

Reimplemented from fl::MatrixAbstract< T >.

template<class T>
Matrix< T > fl::Matrix< T >::transposeSquare   [virtual]
 

Computes the upper triangular part of the symmetric matrix (~this * this).

template<class T>
void fl::Matrix< T >::write std::ostream &    stream,
bool    withName = false
const [virtual]
 

Reimplemented from fl::MatrixAbstract< T >.


Member Data Documentation

template<class T>
int fl::Matrix< T >::columns_
 

template<class T>
Pointer fl::Matrix< T >::data
 

template<class T>
int fl::Matrix< T >::rows_
 


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 17:13:25 2004 for fl by doxygen1.2.18