matrix

A convenience function that allocates memory for a matrix (using the GC), optionally sets the values of the matrix elements, and returns a MatrixView of the allocated memory.

  1. MatrixView!(T) matrix(size_t rows, size_t cols)
    pure
    matrix
    (
    T
    )
    (
    size_t rows
    ,
    size_t cols
    )
  2. MatrixView!(T) matrix(size_t rows, size_t cols, T init)
  3. MatrixView!(T, stor, tri) matrix(size_t n, T init)

Examples

// Allocate general dense 3x4 matrix:
auto denseMatrix = matrix!real(3, 4);

// Allocate dense 3x2 zero-filled matrix:
auto denseZeroMatrix = matrix!real(3, 2, 0.0L);

// Allocate lower triangular 3x3 matrix:
auto loMatrix = matrix!(real, Storage.Triangular, Triangle.Lower)(3);

// Allocate upper triangular 2x2 matrix where the upper
// triangular elements are set to 3.14.
auto upMatrix = matrix!(real, Storage.Triangular)(2, 3.14L);

Meta