<diagonal-matrix> ( diagonal-seq -- matrix )

Matrix operations

Matrix operations

Prev: | <zero-square-matrix> ( n -- matrix ) |

Next: | <anti-diagonal-matrix> ( diagonal-seq -- matrix ) |

Vocabulary

math.matrices

Inputs

Outputs

Word description

Creates a matrix with the specified main diagonal. This word has the opposite effect of main-diagonal.

Notes

To use a diagonal starting in the lower right, reverse the input sequence before calling this word.

Examples

Definition

math.matrices

Inputs

diagonal-seq | a sequence |

Outputs

matrix | a matrix |

Word description

Creates a matrix with the specified main diagonal. This word has the opposite effect of main-diagonal.

Notes

To use a diagonal starting in the lower right, reverse the input sequence before calling this word.

Examples

USING: math.matrices prettyprint ;
{ 1 2 3 } <diagonal-matrix> .

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

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

Definition

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.99 x86.64 (2190, heads/master-46c625f8dc, Feb 4 2023 19:37:27)