struct

Geode::Matrix1x4(T)

Inherits Geode::CommonMatrix < Geode::MatrixVectors < Geode::MatrixOperations < Geode::MatrixIterators < Geode::MatrixComparison < Indexable < Enumerable < Iterable < Struct < Value < Object

Matrix with 1 row and 4 columns. Provides a rectangular array of scalars of the same type.

T is the scalar type. Indices i and j refer to the zero-based row and column index respectively. Unless noted otherwise, all operations are in row-major order.

Constructors

new(matrix : CommonMatrix(T, 1, 4))

Copies contents from another matrix.

Source
new

Creates a new matrix by iterating through each element.

Yields the indices (i and j) for the matrix element. The block should return the value to use for the corresponding element.

Matrix1x4.new { |i, j| i * 10 + j }
Source
new(rows : Indexable(Indexable(T)))

Creates a new matrix from nested collections.

The size of rows must be 1. Each row of elements in rows must have a size of 4.

Source
new(elements : Indexable(T))

Creates a new matrix from a flat collection of elements.

The size of elements must be equal to 1 x 4 (4). Items in elements are consumed in row-major order.

Source
zero

Creates a matrix filled with zeroes.

Source

Class methods

[](row_0 : Indexable)

Constructs a matrix with existing elements.

The type of the elements is specified by the type parameter. Each value is cast to the type T.

Source

Instance methods

&*(other : CommonMatrix(U, 4, P)) : Matrix forall U, P

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Values will wrap instead of overflowing and raising an error.

Source
&*(other : Matrix4x1) : Matrix1x1

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Values will wrap instead of overflowing and raising an error.

Source
&*(other : Matrix4x2) : Matrix1x2

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Values will wrap instead of overflowing and raising an error.

Source
&*(other : Matrix4x3) : Matrix1x3

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Values will wrap instead of overflowing and raising an error.

Source
&*(other : Matrix4x4) : Matrix1x4

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Values will wrap instead of overflowing and raising an error.

Source
*(other : CommonMatrix(U, 4, P)) : Matrix forall U, P

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Source
*(other : Matrix4x1) : Matrix1x1

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Source
*(other : Matrix4x2) : Matrix1x2

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Source
*(other : Matrix4x3) : Matrix1x3

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Source
*(other : Matrix4x4) : Matrix1x4

Multiplies this matrix by another.

The other matrix's row count (M) must be equal to this matrix's column count (N). Produces a new matrix with the row count from this matrix and the column count from other. Matrices can be of any size and type as long as this condition is met.

Source
a

Retrieves the element at (0, 0)

Source
b

Retrieves the element at (0, 1)

Source
c

Retrieves the element at (0, 2)

Source
d

Retrieves the element at (0, 3)

Source
map

Returns a new matrix with elements mapped by the given block.

Source
to_slice

Returns a slice that points to the elements in this matrix.

NOTE: The returned slice is only valid for the caller's scope and sub-calls. The slice points to memory on the stack, it will be invalid after the caller returns.

Source
to_unsafe

Returns a pointer to the data for this matrix.

The elements are tightly packed and ordered consecutively in memory.

NOTE: The returned pointer is only valid for the caller's scope and sub-calls. The pointer refers to memory on the stack, it will be invalid after the caller returns.

Source
transpose

Returns a new matrix that is transposed from this one.

Source
unsafe_fetch(index : Int)

Retrieves the scalar value of the component at the given index, without checking size boundaries.

End-users should never invoke this method directly. Instead, methods like #[] and #[]? should be used.

This method should only be directly invoked if the index is certain to be in bounds.

Source
unsafe_fetch_column(j : Int) : Vector1(T)

Retrieves the column at the specified index.

Returns the elements as a vector. The vector will have a size equal to the number of rows in this matrix. This method does not perform any bounds checks. It should only be used if the indices are guaranteed to be in bounds.

matrix = Matrix[[1, 2, 3], [4, 5, 6]]
matrix.unsafe_fetch_column(1) # => (2, 5)
Source
unsafe_fetch_row(i : Int) : Vector4(T)

Retrieves the row at the specified index.

Returns the elements as a vector. The vector will have a size equal to the number of columns in this matrix. This method does not perform any bounds checks. It should only be used if the indices are guaranteed to be in bounds.

matrix = Matrix[[1, 2, 3], [4, 5, 6]]
matrix.unsafe_fetch_row(1) # => (4, 5, 6)
Source

Macros

[](*rows)

Constructs a matrix with existing elements.

The type of the elements is derived from the type of each argument. The size of rows must be 1 and the size of each row must be 4.

Source