NABLA  Nabla Ain't Basic Linear Algebra
Matrix Shape

In the context of this library "shape" means special property of a matrix (e.g.

symmetry). Knowledge of shape helps to optimize time and space loads of particular operations on such objects, for example one only needs to store roughly half of elements of a matrix which is symmetric by definition (space optimization). Additionally explicit definition of shape ensures design decisions and make it harder to use the library incorectly, e.g. there is no way to resize symmetric matrix to rectangular (non square) size because it is square by definition.

matrix template class is specialized to handle all predefined shapes (see list below). To use matrix with a user defined shape one needs to specialize matrix class for it, e.g.

template<typename value_t>
class matrix<value_t, hermitian> :
public shaped_expression<value_t, matrix<value_t, hermitian>, tag::storage, hermitian>
{
//rest of definition
};

Note that such a type must conform to the requirements of tag::storage.

List of Matrix Shapes

Class lower_triangular
  • matrices are square by definition (have size strictly n by n);
  • elements (i, j) for i<j (i.e. elements above main diagonal) are by definition all equal to zero, they can not be modified; the rest (elements (i, j) for i>=j, i.e. lower triangle elements) may have particular value and can be modified.
Class rectangular
There are no specific constraints for this shape.
Class symmetric
  • matrices are square by definition (have size strictly n by n);
  • elements (i, j) and (j, i) are equal by definition (if (i, j) changes then (j, i) immediately reflects the change).
Class upper_triangular
  • matrices are square by definition (have size strictly n by n);
  • elements (i, j) for i>j (i.e. elements below main diagonal) are by definition all equal to zero, they can not be modified; the rest (elements (i, j) for i<=j, i.e. upper triangle elements) may have particular value and can be modified.