struct

CG2d::Matrix(T, S)

Inherits Indexable::Mutable < Indexable < Enumerable < Iterable < Struct < Value < Object

Constructors

new(width : UInt8, height : UInt8, values : StaticArray(T, S))
Source
new(width : UInt8, height : UInt8)
Source

Instance methods

*(other : Matrix)
Source
==(other : Matrix)

Tests the equality of two matricies

Source
[](col : Int, row : Int)

Fetch a value at a specified column and row

Source
[]=(col : Int, row : Int, value : T)

Put a value at a specified column and row

Source
fill(*args, **options)
Source
fill(*args, **options, &)
Source
height
Source
index(col : Int, row : Int)
Source
size

Returns the number of elements in this container.

Source
to_s(io)
Source
unsafe_fetch(index : Int)

Returns the element at the given index, without doing any bounds check.

Indexable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they access elements with #[](index) and #[]?(index).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.

Source
unsafe_put(index : Int, value : T)

Sets the element at the given index to value, without doing any bounds check.

Indexable::Mutable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they modify elements with #[]=(index, value).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.

Source
values
Source
width
Source

Macros

[](*args)

Creates a new square Matrix with the given args

m = Matrix[1, 2, 3, 4] # => Matrix(Int32, 4) 2x2 [1, 2, 3, 4]
Source