Algosim documentation: ReplaceSubdiagonal

ReplaceSubdiagonal

Returns a matrix with its subdiagonal replaced by a given vector.

Syntax

Description

If A is an m×n matrix and v a vector of dimension m − 1 if m ≤ n and n if m > n, then ReplaceSubdiagonal(A, v) returns the matrix obtained from A by replacing its subdiagonal with the components of v (in order).

Examples

A ≔ ❨❨5, 1, 2, 3, 4❩, ❨4, 0, 2, 1, 7❩, ❨6, 3, 0, 4, 7❩, ❨4, 5, 2, 3, 9❩, ❨4, 0, 1, 2, 5❩❩
⎛5  1  2  3  4⎞
⎜4  0  2  1  7⎟
⎜6  3  0  4  7⎟
⎜4  5  2  3  9⎟
⎝4  0  1  2  5⎠
ReplaceSubdiagonal(A, ❨i, i, i, i❩)
⎛5  1  2  3  4⎞
⎜i  0  2  1  7⎟
⎜6  i  0  4  7⎟
⎜4  5  i  3  9⎟
⎝4  0  1  i  5⎠

See also