OpenWalnut
1.4.0
|
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... | |
typedef boost::shared_ptr< WMatrixSym< T > > | SPtr |
Shorthand for shared pointers. More... | |
Public Member Functions | |
WMatrixSym (size_t n) | |
Generates new symmetric matrix. More... | |
WMatrixSym () | |
Default constructor leaving all empty. More... | |
T & | operator() (size_t i, size_t j) throw ( WOutOfBounds ) |
Element acces operator as if the elements where stored as a normal matrix. More... | |
const T & | operator() (size_t i, size_t j) const throw ( WOutOfBounds ) |
Const version of the element access. 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... | |
std::string | toString (void) const |
Renders the matrix to a full nxn matrix, where the main diagonal is set to 0.0 and the m(i,j) == m(j,i). More... | |
Private Attributes | |
std::vector< T > | m_data |
Internal data structure to store the elements. More... | |
size_t | m_n |
Number of rows and cols. More... | |
Friends | |
class | WMatrixSymTest |
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.
Definition at line 48 of file WMatrixSym.h.
typedef boost::shared_ptr< WMatrixSym < T > > WMatrixSym< T >::SPtr |
Shorthand for shared pointers.
Definition at line 60 of file WMatrixSym.h.
typedef T WMatrixSym< T >::value_type |
Type of stored elements.
Definition at line 55 of file WMatrixSym.h.
|
inlineexplicit |
Generates new symmetric matrix.
n | number of rows and cols |
Definition at line 145 of file WMatrixSym.h.
|
inline |
Default constructor leaving all empty.
Definition at line 152 of file WMatrixSym.h.
|
inline |
Returns the elements stored inside of this container.
Definition at line 312 of file WMatrixSym.h.
|
inline |
Returns the number of elements stored in this matrix.
Definition at line 300 of file WMatrixSym.h.
|
inline |
Element acces operator as if the elements where stored as a normal matrix.
i | The i'th row |
j | The j'th column |
Definition at line 175 of file WMatrixSym.h.
|
inline |
Const version of the element access.
i | The i'th row |
j | The j'th column |
Definition at line 158 of file WMatrixSym.h.
|
inline |
Resets the internal data to the given vector of elements.
data | new data in row major arrangement |
Definition at line 318 of file WMatrixSym.h.
Referenced by WMatrixSymTest::testAccessOn3x3Matrix(), WMatrixSymTest::testInputStream(), WMatrixSymTest::testOutputStream(), WMatrixSymTest::testSetDataWithInvalidLengthForDimension(), and WMatrixSymTest::testToString().
|
inline |
Returns the number of rows and cols of the matrix.
Definition at line 306 of file WMatrixSym.h.
|
inline |
Renders the matrix to a full nxn matrix, where the main diagonal is set to 0.0 and the m(i,j) == m(j,i).
Each column is separated by exactly one space and each row is separated by a newline.
Definition at line 192 of file WMatrixSym.h.
Referenced by WMatrixSymTest::testToString().
|
private |
Internal data structure to store the elements.
The order is row major.
Definition at line 136 of file WMatrixSym.h.
Referenced by WMatrixSymTest::testOperatorOn3x3Matrix().
|
private |
Number of rows and cols.
Definition at line 141 of file WMatrixSym.h.