Given matrices m1, ... , mk
and matrices n1, ... , nk-1
, I would like to define a block matrix
$$ m=\left( \begin{array}{rrrr}m1 & n1 & 0 & 0 \\0 & m2 & \ddots & 0 \\\vdots & \ddots & \ddots & nk-1 \\0 & \dots & 0 & mk \\\end{array}\right) $$
with blocks mi
on the diagonal and blocks nj
on the secondary diagonal. The sizes of the matrices are compatible.
I would like to define m
as an sparse array using the Band function, but I didn't manage. Is it possible?
Edit: Before, I called the matrices m[i]
and n[j]
which was misleading, see kglr's answer
Dimensions
of mi's and ni's? $\endgroup$