namespace ewalena  0.2.15
ewalena is not an acronym
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Attributes | Friends
ewalena::Matrix< ValueType > Class Template Reference

#include <include/ewalena/lac/matrix.h>

List of all members.

Public Member Functions

void identity ()
void invert (const Matrix< ValueType > &M)
bool is_symmetric () const
 Matrix ()
 Matrix (const unsigned int m, const unsigned int n, const bool zero=true)
 Matrix (std::pair< const unsigned int, const unsigned int > mn_pair, const bool zero=true)
template<int dim>
 Matrix (const class Tensor< dim, 2, ValueType > &T)
 Matrix (const class VectorBasis< ValueType > &V)
 Matrix (const Matrix &M)
template<int dim>
 Matrix (const Tensor< dim, 2, ValueType > &T)
template<typename ValueType >
 Matrix (const VectorBasis< ValueType > &V)
void mult (const Matrix< ValueType > &M_a, const Matrix< ValueType > &M_b)
void multT (const Matrix< ValueType > &M_a, const Matrix< ValueType > &M_b)
unsigned int n_cols () const
unsigned int n_rows () const
ValueType norm ()
ValueType & operator() (const unsigned int i, const unsigned int j)
const ValueType & operator() (const unsigned int i, const unsigned int j) const
void operator*= (const ValueType &scalar)
void operator+= (const Matrix< ValueType > &M)
void operator-= (const Matrix< ValueType > &M)
void operator/= (const ValueType &scalar)
void operator= (const Matrix< ValueType > &M)
bool operator== (const Matrix< ValueType > &M) const
void reinit (const unsigned int m, const unsigned int n, const bool zero=true)
void reinit ()
unsigned int size () const
void Tmult (const Matrix< ValueType > &M_a, const Matrix< ValueType > &M_b)
 ~Matrix ()

Protected Member Functions

const ValueType * operator* () const
ValueType * operator* ()

Private Attributes

unsigned int __n_cols
unsigned int __n_rows
ValueType * data

Friends

std::ostream & operator<< (std::ostream &output, const Matrix< ValueType > &M)

Detailed Description

template<typename ValueType = double>
class ewalena::Matrix< ValueType >

A class that denotes a simple matrix with no special qualities, ie. no special symmetries, data access, etc.

Matrices are in row-column format.

Author:
Toby D. Young 2012.

Constructor & Destructor Documentation

template<typename ValueType = double>
ewalena::Matrix< ValueType >::Matrix ( )

Constructor.

template<typename ValueType = double>
ewalena::Matrix< ValueType >::~Matrix ( )

Destructor.

template<typename ValueType = double>
ewalena::Matrix< ValueType >::Matrix ( const unsigned int  m,
const unsigned int  n,
const bool  zero = true 
) [explicit]

Initialize a matrix of size m $\times$n. By default, matrix elements are set to zero otherwise if zero=false, matrix elements are left in an unspecified state.

template<typename ValueType = double>
ewalena::Matrix< ValueType >::Matrix ( std::pair< const unsigned int, const unsigned int >  mn_pair,
const bool  zero = true 
)

Initialize a matrix of size equal to the first, and second, integers of a pair.

template<typename ValueType = double>
template<int dim>
ewalena::Matrix< ValueType >::Matrix ( const class Tensor< dim, 2, ValueType > &  T)

Initialize a matrix with a tensor T with a memory copy.

Note:
This initializer is provided for rank two tensors only - while other ranks remain undefined.
template<typename ValueType = double>
ewalena::Matrix< ValueType >::Matrix ( const class VectorBasis< ValueType > &  V)

Initialize a matrix with a vector basis V with a memory copy.

template<typename ValueType = double>
ewalena::Matrix< ValueType >::Matrix ( const Matrix< ValueType > &  M)

Initialize a matrix with another matrix M with a memory copy.

template<typename ValueType = double>
template<int dim>
ewalena::Matrix< ValueType >::Matrix ( const Tensor< dim, 2, ValueType > &  T)
template<typename ValueType = double>
template<typename ValueType >
ewalena::Matrix< ValueType >::Matrix ( const VectorBasis< ValueType > &  V)

Member Function Documentation

template<typename ValueType >
void ewalena::Matrix< ValueType >::identity ( ) [inline]

Make this matrix the identity matrix (all previous data is overwritten).

template<typename ValueType >
void ewalena::Matrix< ValueType >::invert ( const Matrix< ValueType > &  M) [inline]

Return the inverse of matrix $M$.

template<typename ValueType >
bool ewalena::Matrix< ValueType >::is_symmetric ( ) const [inline]

Return true if this matrix is symmetric, otherwise return false.

template<typename ValueType >
void ewalena::Matrix< ValueType >::mult ( const Matrix< ValueType > &  M_a,
const Matrix< ValueType > &  M_b 
) [inline]

Multiply two matrices together: $M_{ij}=M_{(a)ik}M_{(b)kj}$.

template<typename ValueType >
void ewalena::Matrix< ValueType >::multT ( const Matrix< ValueType > &  M_a,
const Matrix< ValueType > &  M_b 
) [inline]

Multiply transpose two matrices together: $M_{ij}=M_{(a)ik}M_{(b)jk}$.

template<typename ValueType >
unsigned int ewalena::Matrix< ValueType >::n_cols ( ) const [inline]

Return the number of columns this matrix has.

template<typename ValueType >
unsigned int ewalena::Matrix< ValueType >::n_rows ( ) const [inline]

Return the number of rows this matrix has.

template<typename ValueType >
ValueType ewalena::Matrix< ValueType >::norm ( ) [inline]

Return the norm of this matrix.

template<typename ValueType >
ValueType & ewalena::Matrix< ValueType >::operator() ( const unsigned int  i,
const unsigned int  j 
) [inline]

Read-write access to the (i, j)th component of this matrix.

template<typename ValueType >
const ValueType & ewalena::Matrix< ValueType >::operator() ( const unsigned int  i,
const unsigned int  j 
) const [inline]

Read only access to the ith, jth index of this matrix.

template<typename ValueType = double>
const ValueType* ewalena::Matrix< ValueType >::operator* ( ) const [inline, protected]

Read only access operator to the underlying C array structure associated with this matrix.

template<typename ValueType = double>
ValueType* ewalena::Matrix< ValueType >::operator* ( ) [inline, protected]

Read-write access operator to the underlying C array structure associated with this matrix.

template<typename ValueType >
void ewalena::Matrix< ValueType >::operator*= ( const ValueType &  scalar) [inline]

Inline multiplication operator. Multiply every element in M by a scalar.

template<typename ValueType >
void ewalena::Matrix< ValueType >::operator+= ( const Matrix< ValueType > &  M) [inline]

Inline addition operator. Add M to this matrix.

template<typename ValueType >
void ewalena::Matrix< ValueType >::operator-= ( const Matrix< ValueType > &  M) [inline]

Inline subtraction operator. Subtract M from this matrix.

template<typename ValueType >
void ewalena::Matrix< ValueType >::operator/= ( const ValueType &  scalar) [inline]

Inline division operator. Divide every element in M by a scalar.

template<typename ValueType >
void ewalena::Matrix< ValueType >::operator= ( const Matrix< ValueType > &  M)

Equal operator. This is equivalent to a copy.

template<typename ValueType >
bool ewalena::Matrix< ValueType >::operator== ( const Matrix< ValueType > &  M) const [inline]

Equivalence operator. Return true if this matrix is an identical copy of the matrix M.

template<typename ValueType = double>
void ewalena::Matrix< ValueType >::reinit ( const unsigned int  m,
const unsigned int  n,
const bool  zero = true 
)

Reinitialise this matrix to size m, n.

template<typename ValueType = double>
void ewalena::Matrix< ValueType >::reinit ( )

Reinitialise the contents of this matrix.

template<typename ValueType >
unsigned int ewalena::Matrix< ValueType >::size ( ) const [inline]

Return the number of columns this matrix has.

template<typename ValueType >
void ewalena::Matrix< ValueType >::Tmult ( const Matrix< ValueType > &  M_a,
const Matrix< ValueType > &  M_b 
) [inline]

Transpose multiply two matrices togerher: $M_{ij}=M_{(a)ki}M_{(b)kj}$.


Friends And Related Function Documentation

template<typename ValueType = double>
std::ostream& operator<< ( std::ostream &  output,
const Matrix< ValueType > &  M 
) [friend]

Output operator to stream.


Member Data Documentation

template<typename ValueType = double>
unsigned int ewalena::Matrix< ValueType >::__n_cols [private]

Internal reference to this matrix column size, ie. the number of columns this matrix has.

template<typename ValueType = double>
unsigned int ewalena::Matrix< ValueType >::__n_rows [private]

Internal reference to this matrix row-size, ie. the number of rows this matrix has.

template<typename ValueType = double>
ValueType* ewalena::Matrix< ValueType >::data [private]

Internal object denoting this matrix data.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines