MatrixView

A matrix-like view of the contents of an array.

In order to be compatible with LAPACK routines, the following matrix representations (i.e., memory layouts) are supported.

Constructors

this
this(T[] a, size_t m)

Wraps a MatrixView with m rows around the given array.

this
this(T[] a, size_t m, size_t n)

Wraps a MatrixView with m rows and n columns around the given array. For a given set of a, m, and n, the following must be true for a general matrix:

Members

Aliases

leading
alias leading = rows

The leading (row) dimension. Included to support matrix slicing, currently just an alias to rows.

Functions

opIndex
T opIndex(size_t i, size_t j)

Returns (a reference to) the element at row i, column j.

opIndexAssign
T opIndexAssign(T value, size_t i, size_t j)

Assigns a value to the element at row i, column j.

Variables

array
T[] array;

The array that is wrapped by this MatrixView.

cols
size_t cols;

The number of columns in the matrix.

rows
size_t rows;

The number of rows in the matrix.

storage
enum Storage storage;
Undocumented in source.
triangle
enum Triangle triangle;
Undocumented in source.

Detailed Description

General matrices

The elements of dense matrices are stored in column-major order. This means that if the wrapped array contains the elements

a b c d e f g h i j k l

then a 3x4 dense matrix view of this array looks like this:

a d g j
b e h k
c f i l

Triangular matrices

Triangular matrices are required to be square. If the wrapped array contains the six elements

a b c d e f

then the resulting 3x3 upper and lower triangular matrix views will look like this, respectively:

a b d         a 0 0
0 c e   and   b d 0
0 0 f         c e f

Symmetric matrices

Symmetric matrices are stored in the same way as triangular matrices. This means that for the array above, the corresponding symmetric matrix view will be

a b d       a b c
b c e   or  b d e
d e f       c e f

depending on whether the upper or lower triangle is stored.

Hermitian matrices

Hermitian matrices are not implemented yet.

See Also

LAPACK User's Guide: Matrix storage schemes, http://www.netlib.org/lapack/lug/node121.html

Meta