HILA
Loading...
Searching...
No Matches
Matrix<n,m,T>

User guide for custom HILA Matrix class

The Matrix object is simply an \(n \times m\) matrix, where n is the number of rows and m is the number of columns. The goal is to have an object which defines the mathematical definition of a Matrix. For a general array type see Array.

NOTE: n,m are integers and T is a HILA standard type or Complex.

Matrix is defined with the base class Matrix_t (See documentation for details). Vector, RowVector and SquareMatrix are special alias cases of Matrix Class additionally SU and DiagonalMatrix are special cases of Matrix_t. Thus most methods for the aliases and special cases are inherited from Matrix.

The special alias cases have some functions specific to them which are documented on this page while SU and DiagonalMatrix have their own dedicated pages.

Construction, Assignment

NOTE: Construction and assignment is possible only when the assignable values type or it's

element type is compatible with the type T of the Matrix<T> variable.

The multiple ways of constructing and assigning a Matrix object can be viewed on the Object documentation page

A simple example of constructing a Matrix object is as follows:

Matrix<n,m,T> M(1); // Allocates Matrix.c which is simply an n*m c style array
Matrix<n,m,T> N = M; // Copy constructor: copies the contents of M into N
N = M + 1; // Assignment operator: Scalar is treated as identity 1*I, N = M + 1 = 2*I
Matrix class which defines matrix operations.
Definition matrix.h:1679

Set elements

Access

Array indexing operation for matrices and vectors with Matrix::e

Accessing singular elements is insufficient, but matrix elements are often quite small.

Example for matrix:

T a = M.e(i,j); \\ i <= n, j <= m

Example for vector:

T a = V.e(i) \\ i <= n
T e(const int i, const int j) const
Standard array indexing operation for matrices.
Definition matrix.h:272

Standard array indexing operation for vectors only with Matrix::operator[]

T a = V[i] \\ i <= n

Access row, column or diagonal elemetns

Mathematical methods

The arithmetic methods and arithmetic assignment methods hold allot of overloads depending on specific objects they are called for. All cases are documented and should be listed in order on the class page. These can be seen by following the links below.

Standard arithmetic methods

The following standard arithmetic methods are defined in the usual way for Matrices numbers.

Arithmetic assignment methods

Mathematical functions

Random number generators

There are two random number generators available for the Matrix type.

More detailed description on the functionality for both functions can be read on the Class page.