fixarray::Fixed
A fixed-extent, inline-stored array — an cheatah::ndarray::NDArray whose shape lives in the type.
Trivially copyable and allocation-free; a matrix is stored column-major (see the file doc).
T | the element type; any cheatah::ndarray::Field, exactly as |
Dims | the extents. One extent is a vector, two are a matrix (rows, then columns). |
Functions
Fixed · 3 overloads
Every element zero — the additive identity, and what a default-constructed value holds.
operator[] · 4 overloads
Element i of a vector.
i | the index, |
a reference to the element.
O(1).
none.
Fixarray.VectorIndexingoperator() · 4 overloads
Element (row, col) of a matrix.
The index is mathematical; the storage is column-major.
a reference to the element.
O(1).
none.
Fixarray.MatrixIndexingdata · 2 overloads
A pointer to the elements, contiguous — column-major for a matrix, which is exactly the order a GPU uniform, a push constant or a BLAS call expects, so an upload is a copy not a transpose.
Elementwise equality.
Exact, as == on the elements is exact — floating-point values compare only if they are bit-for-bit equal.
other | the array to compare with. |
true iff every element matches.
O(size).
none.
Fixarray.EqualityAdd other elementwise, in place.
other | the array to add. |
a reference to this array.
O(size).
none.
Fixarray.ArithmeticSubtract other elementwise, in place.
other | the array to subtract. |
a reference to this array.
O(size).
none.
Fixarray.ArithmeticScale every element by scalar, in place.
scalar | the factor. |
a reference to this array.
O(size).
none.
Fixarray.ArithmeticDivide every element by scalar, in place.
scalar | the divisor. |
a reference to this array.
O(size).
none.
Fixarray.ArithmeticThe square identity: ones on the diagonal, zeros elsewhere.
Every element set to value — filled(0) is the zero value, filled(1) a matrix of ones.
value | the element to repeat. |
the filled array.
O(size).
none.
Fixarray.FilledBuild an array elementwise: each element i of the flat, contiguous buffer is f(i).
This is the allocation-free, single-pass way to write a component-wise operation — no default zeroing and no separate copy to overwrite, so a call like abs or min compiles to one vector pass (minps/maxpd) rather than two. The index i runs over the storage order (column-major for a matrix), which is exactly what an elementwise operation wants.
F | a callable |
f | produces element |
the array whose element i is f(i).
O(size).
none.
Fixarray.FromIndicesidentity's worker: emits each element exactly once, with no zeroing pass.
I | the flat indices 0 … size-1. |
the identity matrix.
from_indices's worker: aggregate-initialises the buffer from f(0) … f(size-1), fully unrolled, so there is no loop, no zeroing, and no pointer through which the operands alias.
F | the element-producing callable. |
I | the flat indices 0 … size-1. |
f | produces each element from its flat index. |
the array of f(i).
Constants & variables
The number of extents: 1 for a vector, 2 for a matrix.
The total number of elements.
The extents, in order (rows, then columns for a matrix).
Rows — the first extent (a vector has one row).
Columns — the second extent, or 1 for a vector.
The elements, inline: a vector in order, a matrix column by column. Zero by default.
Types
The element type.
