antidiagonal
Represents the antidiagonal in a matrix.
Syntax
-
antidiagonal(A)
-
A
is a matrix
-
The returned value is an lvalue.
Description
If A
is a square matrix then antidiagonal(A)
represents the antidiagonal in A
, that is, the entries A[i, j]
where i = n − j + 1
where n
is the size of A
, from the top-right to the bottom-left corner.
Typewise, antidiagonal(A)
is a vector.
antidiagonal(A)
is an lvalue, so it may be assigned to. If A
is a real matrix, then only a real vector can be assigned to it.
Examples
A ≔ ❨❨5, 2, 1❩, ❨3, 6, 9❩, ❨0, 2, 1❩❩
⎛5 2 1⎞ ⎜3 6 9⎟ ⎝0 2 1⎠
antidiagonal(A)
⎛1⎞ e⎜6⎟ ⎝0⎠
antidiagonal(A) ≔ ❨3, 9, 4❩
⎛3⎞ e⎜9⎟ ⎝4⎠
A
⎛5 2 3⎞ ⎜3 9 9⎟ ⎝4 2 1⎠