struct PF::Matrix(T, S)

Included Modules

Defined in:

matrix.cr

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(width : UInt8, height : UInt8, values : StaticArray(T, S)) #

[View source]
def self.new(width : UInt8, height : UInt8) #

[View source]

Macro Detail

macro [](*args) #

Creates a new square Matrix with the given args

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

[View source]

Instance Method Detail

def *(other : Matrix) #

[View source]
def ==(other : Matrix) #

Tests the equality of two matricies


[View source]
def [](col : Int, row : Int) #

Fetch a value at a specified column and row


[View source]
def []=(col : Int, row : Int, value : T) #

Put a value at a specified column and row


[View source]
def fill(*args, **options) #

[View source]
def fill(*args, **options, &) #

[View source]
def height : UInt8 #

[View source]
def index(col : Int, row : Int) #

[View source]
def size #
Description copied from module Indexable(T)

Returns the number of elements in this container.


[View source]
def to_s(io) #

[View source]
def unsafe_fetch(index : Int) #
Description copied from module Indexable(T)

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.


[View source]
def unsafe_put(index : Int, value : T) #
Description copied from module Indexable::Mutable(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.


[View source]
def values : StaticArray(T, S) #

[View source]
def width : UInt8 #

[View source]