Algosim documentation: LeadingPrincipalSubmatrix

LeadingPrincipalSubmatrix

Creates a leading principal submatrix.

Syntax

Description

If A is a matrix and n a positive integer no greater than min(size(A)) then LeadingPrincipalSubmatrix(A, n) returns the submatrix obtained from A by keeping the first n rows and and the first n columns.

Examples

A ≔ ❨❨4, 1, 2, 3❩, ❨6, 1, 2, 3❩, ❨7, 6, 5, 0❩, ❨1, 2, 1, 6❩, ❨5, 6, 3, 2❩❩
⎛4  1  2  3⎞
⎜6  1  2  3⎟
⎜7  6  5  0⎟
⎜1  2  1  6⎟
⎝5  6  3  2⎠
for(n, 1, min(size(A)), print(AsMultiLine(LeadingPrincipalSubmatrix(A, n))~¶))
(4)

⎛4  1⎞
⎝6  1⎠

⎛4  1  2⎞
⎜6  1  2⎟
⎝7  6  5⎠

⎛4  1  2  3⎞
⎜6  1  2  3⎟
⎜7  6  5  0⎟
⎝1  2  1  6⎠

See also