OpenWalnut  1.3.1
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
WMatrixSymImpl< T > Class Template Reference

Symmetric square matrix, storing only the elements of the triangular matrix without the main diagonal. More...

#include <WMatrixSym.h>

Public Types

typedef T value_type
 Type of stored elements. More...
 

Public Member Functions

 WMatrixSymImpl (size_t n)
 Generates new symmetric matrix. More...
 
 WMatrixSymImpl ()
 Default constructor leaving all empty. More...
 
Toperator() (size_t i, size_t j) throw ( WOutOfBounds )
 Element acces operator as if the elements where stored as a normal matrix. More...
 
size_t numElements () const
 Returns the number of elements stored in this matrix. More...
 
size_t size () const
 Returns the number of rows and cols of the matrix. More...
 
const std::vector< T > & getData () const
 Returns the elements stored inside of this container. More...
 
void setData (const std::vector< T > &data) throw ( WOutOfBounds )
 Resets the internal data to the given vector of elements. More...
 

Private Attributes

std::vector< Tm_data
 Internal data structure to store the elements. More...
 
size_t m_n
 Number of rows and cols. More...
 

Friends

class WMatrixSymTest
 

Detailed Description

template<typename T>
class WMatrixSymImpl< T >

Symmetric square matrix, storing only the elements of the triangular matrix without the main diagonal.

So in case of a NxN matrix there are only (N^2-N)/2 elements stored.

Notes:
There exists also a WWriter and WReader for storing/reading the matrix in VTK file format.

Definition at line 41 of file WMatrixSym.h.

Member Typedef Documentation

template<typename T >
typedef T WMatrixSymImpl< T >::value_type

Type of stored elements.

Definition at line 48 of file WMatrixSym.h.

Constructor & Destructor Documentation

template<typename T >
WMatrixSymImpl< T >::WMatrixSymImpl ( size_t  n)
inlineexplicit

Generates new symmetric matrix.

Parameters
nnumber of rows and cols

Definition at line 113 of file WMatrixSym.h.

template<typename T >
WMatrixSymImpl< T >::WMatrixSymImpl ( )
inline

Default constructor leaving all empty.

Definition at line 120 of file WMatrixSym.h.

Member Function Documentation

template<typename T >
const std::vector< T > & WMatrixSymImpl< T >::getData ( ) const
inline

Returns the elements stored inside of this container.

Returns
Read-only reference to the elements stored inside this container.

Definition at line 154 of file WMatrixSym.h.

template<typename T >
size_t WMatrixSymImpl< T >::numElements ( ) const
inline

Returns the number of elements stored in this matrix.

Returns
the number of elements stored in this matrix.

Definition at line 142 of file WMatrixSym.h.

template<typename T >
T & WMatrixSymImpl< T >::operator() ( size_t  i,
size_t  j 
)
throw (WOutOfBounds
)
inline

Element acces operator as if the elements where stored as a normal matrix.

Warning
Acessing elements of the main diagonal is forbidden!
Parameters
iThe i'th row
jThe j'th column
Returns
reference to the (i,j) element of the table

Definition at line 126 of file WMatrixSym.h.

template<typename T >
void WMatrixSymImpl< T >::setData ( const std::vector< T > &  data)
throw (WOutOfBounds
)
inline

Resets the internal data to the given vector of elements.

Parameters
datanew data in row major arrangement

Definition at line 160 of file WMatrixSym.h.

Referenced by WMatrixSymTest::testAccessOn3x3Matrix(), and WMatrixSymTest::testSetDataWithInvalidLengthForDimension().

template<typename T >
size_t WMatrixSymImpl< T >::size ( ) const
inline

Returns the number of rows and cols of the matrix.

Returns
The number of rows and cols of the matrix.

Definition at line 148 of file WMatrixSym.h.

Member Data Documentation

template<typename T >
std::vector< T > WMatrixSymImpl< T >::m_data
private

Internal data structure to store the elements.

The order is row major.

Definition at line 104 of file WMatrixSym.h.

Referenced by WMatrixSymTest::testOperatorOn3x3Matrix().

template<typename T >
size_t WMatrixSymImpl< T >::m_n
private

Number of rows and cols.

Definition at line 109 of file WMatrixSym.h.


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