VectorMatrix is a generalised, STL-map-based, matrix based on a Vector of Vectors. More...
#include <vector_matrix.h>
Public Member Functions | |
VectorMatrix () | |
Default constructor - constructs an empty matrix. More... | |
VectorMatrix (const unsigned &n, const unsigned &m, const VALUE_TYPE &val) | |
Constructor - constructs an n by m matrix with value val. More... | |
VectorMatrix (const unsigned &n, const unsigned &m) | |
Constructor - constructs an n by m matrix, the value is defined by the default initialisation of VALUE_TYPE. More... | |
virtual | ~VectorMatrix () |
Default virtual destructor. More... | |
const unsigned | nrow () const |
returns the number of rows. This is the outer Vector size. More... | |
const unsigned | ncol () const |
return the number of columns. This is the size of the first inner vectors, or returns 0 if the outer vector is of size 0 (this->nrow() is 0). More... | |
Vector< VALUE_TYPE > & | operator[] (const size_t i) |
[] access function to the i-th inner vector. More... | |
const Vector< VALUE_TYPE > & | operator[] (const size_t i) const |
[] access function to the i-th inner vector const version More... | |
void | clear () |
Clears the outer vector. Calling Vector::clear() will invoke the destructor of all the inner Vectors. More... | |
void | resize (const size_t &n, const size_t &m, VALUE_TYPE val=VALUE_TYPE()) |
Resize the existing VectorMatrix. WARNING: This invokes the resize function in std::vector, as such, only new values are assigned, old values as kept. e.g. if vec = [2,2,2], then vec.resize(5,3) gives vec = [2, 2, 2, 3, 3]. More... | |
void | assign (const size_t &n, const size_t &m, const VALUE_TYPE &val) |
Any elements held in the container before the call are destroyed and replaced by newly constructed elements (no assignments of elements take place). This causes an automatic reallocation of the allocated storage space if -and only if- the new vector size surpasses the current vector capacity. This invokes std::assign on both the outer vector and the inner vectors. More... | |
Protected Member Functions | |
void | build_vectors (const unsigned &n, const unsigned &m) |
Builds an n by m VectorMatrix with default VALUE_TYPE. More... | |
void | build_vectors_and_value (const unsigned &n, const unsigned &m, const VALUE_TYPE &val) |
Build an m by n VectorMatrix with VALUE_TYPE val. More... | |
Protected Attributes | |
Vector< Vector< VALUE_TYPE > > | Vector_matrix |
Here's the generalised matrix structure: A Vector of Vector to templated by VALUE_TYPE. More... | |
VectorMatrix is a generalised, STL-map-based, matrix based on a Vector of Vectors.
Example of usage:
Definition at line 78 of file vector_matrix.h.
|
inline |
Default constructor - constructs an empty matrix.
Definition at line 82 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
|
inline |
Constructor - constructs an n by m matrix with value val.
Definition at line 88 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::build_vectors_and_value().
|
inline |
Constructor - constructs an n by m matrix, the value is defined by the default initialisation of VALUE_TYPE.
Definition at line 95 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::build_vectors().
|
inlinevirtual |
Default virtual destructor.
Definition at line 101 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::clear().
|
inline |
Any elements held in the container before the call are destroyed and replaced by newly constructed elements (no assignments of elements take place). This causes an automatic reallocation of the allocated storage space if -and only if- the new vector size surpasses the current vector capacity. This invokes std::assign on both the outer vector and the inner vectors.
Definition at line 226 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
|
inlineprotected |
Builds an n by m VectorMatrix with default VALUE_TYPE.
Definition at line 234 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
Referenced by oomph::VectorMatrix< VALUE_TYPE >::VectorMatrix().
|
inlineprotected |
Build an m by n VectorMatrix with VALUE_TYPE val.
Definition at line 240 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
Referenced by oomph::VectorMatrix< VALUE_TYPE >::VectorMatrix().
|
inline |
Clears the outer vector. Calling Vector::clear() will invoke the destructor of all the inner Vectors.
Definition at line 201 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
Referenced by oomph::VectorMatrix< VALUE_TYPE >::~VectorMatrix().
|
inline |
return the number of columns. This is the size of the first inner vectors, or returns 0 if the outer vector is of size 0 (this->nrow() is 0).
Definition at line 146 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::nrow(), and oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
Referenced by oomph::BlockPreconditioner< MATRIX >::get_concatenated_block().
|
inline |
returns the number of rows. This is the outer Vector size.
Definition at line 107 of file vector_matrix.h.
References oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
Referenced by oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), and oomph::VectorMatrix< VALUE_TYPE >::ncol().
|
inline |
[] access function to the i-th inner vector.
Definition at line 187 of file vector_matrix.h.
References i, and oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
|
inline |
[] access function to the i-th inner vector const version
Definition at line 193 of file vector_matrix.h.
References i, and oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
|
inline |
Resize the existing VectorMatrix. WARNING: This invokes the resize function in std::vector, as such, only new values are assigned, old values as kept. e.g. if vec = [2,2,2], then vec.resize(5,3) gives vec = [2, 2, 2, 3, 3].
Definition at line 211 of file vector_matrix.h.
References i, and oomph::VectorMatrix< VALUE_TYPE >::Vector_matrix.
|
protected |
Here's the generalised matrix structure: A Vector of Vector to templated by VALUE_TYPE.
Definition at line 249 of file vector_matrix.h.
Referenced by oomph::VectorMatrix< VALUE_TYPE >::assign(), oomph::VectorMatrix< VALUE_TYPE >::build_vectors(), oomph::VectorMatrix< VALUE_TYPE >::build_vectors_and_value(), oomph::VectorMatrix< VALUE_TYPE >::clear(), oomph::VectorMatrix< VALUE_TYPE >::ncol(), oomph::VectorMatrix< VALUE_TYPE >::nrow(), oomph::VectorMatrix< VALUE_TYPE >::operator[](), oomph::VectorMatrix< VALUE_TYPE >::resize(), and oomph::VectorMatrix< VALUE_TYPE >::VectorMatrix().