Matrix(T, M, N)
Inherits Indexable < Enumerable < Iterable < Struct < Value < Object
Generic, type-safe abstract matrix structure.
This structure provides an M x N rectangular array of any field T. That is, T must define operations for addition, subtraction, multiplication and division.
Where possible, all matrix operations provide validation at the type level.
Constructors
Class methods
Creates a Matrix from elements contained within a StaticArray.
The matrix will be filled rows first, such that an array of
[1, 2, 3, 4]
becomes
| 1 2 | | 3 4 |
Build the idenity matrix for the instanced type and dimensions.
id may be used to specify an identity element for the type. If unspecifed
a numeric identity will be assumed.
Instance methods
Returns a new Matrix that is the result of performing a matrix addition with other
Returns a new Matrix that is the result of performing a matrix subtraction with other
Equality. Returns true if each element in self is equal to each
corresponding element in other.
Retrieves the value of the element at i,j.
Indicies are zero-based. Negative values may be passed for i and j to
enable reverse indexing such that self[-1, -1] == self[M - 1, N - 1]
(same behaviour as arrays).
Merge with another similarly dimensions matrix, apply the passed block to each elemenet pair.
Yields the current element at i,j and updates the value with the block's return value.