<square-rows> ( desc -- matrix )

Matrix operations

Matrix operations

Prev: | <coordinate-matrix> ( dim -- coordinates ) |

Next: | <square-cols> ( desc -- matrix ) |

Vocabulary

math.matrices

Inputs

Outputs

Generic word contract

Generate a square-matrix from a descriptor.

Word description

If the descriptor is an integer, it is used to generate square rows within that range.

If it is a 1-dimensional sequence, it is replicated to create each row.

If it is a matrix, it is cropped into a square-matrix.

If it is a square-matrix, it is returned unchanged.

Examples

Definition

Methods

math.matrices

Inputs

desc | a sequence, an integer, or a matrix |

Outputs

matrix | a matrix |

Generic word contract

Generate a square-matrix from a descriptor.

Word description

If the descriptor is an integer, it is used to generate square rows within that range.

If it is a 1-dimensional sequence, it is replicated to create each row.

If it is a matrix, it is cropped into a square-matrix.

If it is a square-matrix, it is returned unchanged.

Examples

USING: math.matrices prettyprint ;
3 <square-rows> .

{ { 0 1 2 } { 0 1 2 } { 0 1 2 } }

{ { 0 1 2 } { 0 1 2 } { 0 1 2 } }

USING: math.matrices prettyprint ;
{ 2 3 5 } <square-rows> .

{ { 2 3 5 } { 2 3 5 } { 2 3 5 } }

{ { 2 3 5 } { 2 3 5 } { 2 3 5 } }

Definition

Methods

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.101 x86.64 (2282, heads/master-d344c0817a, Nov 2 2024 14:32:28)