MatrixInfo

Some reflective information about multidimensional arrays

Handles dynamic arrays, static arrays, and pointers to static arrays.

Members

Aliases

MatrixElementType
alias MatrixElementType = _dim.elt

Matrix element type of T E.g. immutable(double) for T=immutable(double[4][4])

RectArrayType
alias RectArrayType = _rect_type!(unqual, 0)

unqualified highest dimension subtype of T forming RectArray

dim_list
alias dim_list = _dim.list

tuple of dimensions of T. dim_list[0] will be the dimension furthest from the MatrixElementType i.e. for double[1][2][3], dim_list == (3, 2, 1). Lists -1 as dimension of dynamic arrays.

unqual
alias unqual = _dim.unqual*

T, with all nonmutable qualifiers stripped away.

Functions

build_shape
Py_ssize_t[] build_shape(T t)

Build shape from t. Assumes all arrays in a dimension are initialized and of uniform length.

check
bool check(Py_ssize_t[] shape)

Ensures that T can store a matrix of _shape shape.

matrixIter
string matrixIter(string arr_name, string shape_name, string index_name, size_t ndim, string pre_code, string post_code)

Generate a mixin string of nested for loops that iterate over the first ndim dimensions of an array of type T (or, preferrably MatrixInfo!T.unqual).

Manifest constants

ndim
enum ndim;

number of dimensions of this matrix

Variables

dimstring
enum string dimstring;

Pretty string of dimension list for T

isRectArray
enum bool isRectArray;

T is a RectArray if: * it is any multidimensional static array (or a pointer to) * it is a 1 dimensional dynamic array

rectArrayAt
enum size_t rectArrayAt;

Highest dimension where it and all subsequent dimensions form a RectArray.

Meta