Creates a compressed diagonal storage matrix corresponding to a banded square matrix. |
||
Syntax |
M = BandMatrix(size, kl, ku) |
|
Arguments |
Name |
Description |
size |
The size of each dimension of the original square matrix. |
|
kl |
Number of sub-diagonals in the lower band of the original matrix. This should include zero entry off-diagonals that sit in-between non-zero off-diagonals. |
|
ku |
Number of super diagonals in the upper band of the original matrix. This should include zero entry off-diagonals that sit in-between non-zero off-diagonals. |
|
Output |
Name |
Description |
M |
The corresponding compressed diagonal storage matrix initialized with zeros. The number of rows of M is 2*kl+ku+1 and the number of columns equal size. |
|
Example |
Construct the compressed diagonal storage matrix for A, where A is a 3x3 matrix with one sub- and super-diagonal. |
|
Syntax |
||
|
kl=1; ku=1; // off diagonals M = BandMatrix(3,kl,ku); // The compressed diagonal storage matrix |
|
|
Result |
|
|
M = [Matrix] 4 x 3 0 0 0 0 0 0 0 0 0 0 0 0 |
|
See Also: |