User:Aeriform/skyline matrix

A skyline matrix is a form of a square, banded (and typically symmetric) matrix that reduces the storage requirement of a matrix due to it's banded nature. For symmetrical matrices (with zero based indexing): $$ A_{skyline}(i,j) = \begin{cases} A_{original}(i,j-i) & \mbox{if } i \le j \le i+bandwidth \\ 0 & otherwise \end{cases} $$ For unsymmetrical matrices (with zero based indexing): $$ A_{skyline}(i,j) = \begin{cases} A_{original}(i,j-i) & \mbox{if } i-bandwidth_{left} < j \le i+bandwidth_{right} \\ 0 & otherwise \end{cases} $$

Examples:

For a symmetric 6 by 6 matrix A with a bandwidth of 3 turns into the 6 by 3 matrix A_{skyline}. Matrix A in original format: $$ \begin{bmatrix} A_{11} & A_{12} & A_{13} &  0  & \cdots & 0 \\ & A_{22} & A_{23} & A_{24} & \ddots & \vdots \\ &       & A_{33} & A_{34} & A_{35} & 0 \\ &       &        & A_{44} & A_{45} & A_{46} \\ & sym   &        &        & A_{55} & A_{56} \\ &       &        &        &        & A_{66} \end{bmatrix} $$ Matrix A_{skyline} in skyline format: $$ \begin{bmatrix} A_{11} & A_{12} & A_{13} \\ A_{22} & A_{23} & A_{24} \\ A_{33} & A_{34} & A_{35} \\ A_{44} & A_{45} & A_{46} \\ A_{55} & A_{56} & 0 \\ A_{66} & 0 & 0 \end{bmatrix} $$ For an unsymmetrical 6 by 6 matrix B with left and right band widths of 2 turns into the 6 by 3 matrix B_{skyline}. Matrix B in original format: $$ \begin{bmatrix} B_{11} & B_{12} & 0     & \cdots & \cdots & 0 \\ B_{21} & B_{22} & B_{23} & \ddots & \ddots & \vdots \\ 0    & B_{32} & B_{33} & B_{34} & \ddots & \vdots \\ \vdots & \ddots & B_{43} & B_{44} & B_{45} & 0 \\ \vdots & \ddots & \ddots & B_{54} & B_{55} & B_{56} \\ 0     & \cdots & \cdots & 0      & B_{65} & B_{66} \end{bmatrix} $$ Matrix B_{skyline} in skyline format: $$ \begin{bmatrix} 0 & B_{11} & B_{12}\\ B_{21} & B_{22} & B_{23} \\ B_{32} & B_{33} & B_{34} \\ B_{43} & B_{44} & B_{45} \\ B_{54} & B_{55} & B_{56} \\ B_{65} & B_{66} & 0 \end{bmatrix} $$