A diagonal matrix is defined as a matrix that has zero entries outside the main
diagonal; that is,
D(i,j) == 0 if
i != j.
Most often, square diagonal matrices are considered; however, the definition can
equally be applied to non-square matrices, in which case we usually speak of a
rectangular diagonal matrix.
A permutation matrix is defined as a square matrix that has a single element
equal to unity in each row and each column; all other elements are zero. That
is, there exists a permutation (vector)
p such that
P(i,j) == 1 if
j == p(i) and
P(i,j) == 0 otherwise.
Octave provides special treatment of real and complex rectangular diagonal matrices, as well as permutation matrices. They are stored as special objects, using efficient storage and algorithms, facilitating writing both readable and efficient matrix algebra expressions in the Octave language.
|• Creating Diagonal Matrices:|
|• Creating Permutation Matrices:|
|• Explicit and Implicit Conversions:|