class

Ish::Matrix(T)

Inherits Reference < Object

Constructors

new(m : Int, n : Int, value : T)

Creates a m x n matrix with each element initialized as value.

Source
new(m : Int, n : Int, &)

Creates an m x n matrix, yielding indicies for each element to provide an initial value.

Source

Instance methods

[](i : Int, j : Int) : T

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).

Source
[]=(i : Int, j : Int, value : T)

Sets the value of the element at i,j.

Source
size

Returns the dimensions of self as a tuple of {m, n}.

Source
update(i, j, &block : T -> T)

Yields the current element at i,j and updates the value with the block's return value.

Source