$\newcommand{\d}{\vec{d}}$ $\newcommand{\S}{\vec{S}}$
In Mathematica one can easily solve a linear system given by
$$A \vec{S} = \vec{d}$$
where $A$ is a matrix, simply by using
S = LinearSolve[A,d]
.
I don't know if this has a name, but I am wondering if there is a nice way to solve a generalized system of linear equations such as this one (this is a specific example but the form of the matrix on the left is unimportant, only that it is a "matrix of matrices"): $$ \begin{bmatrix} 1 & A & 0 & & & 0 \\[8pt] -A & 1 & A & & & \\[1pt] 0 & -A & 1 & \ddots & & \\[1pt] & & \ddots & \ddots & & \\[1pt] & & & & 1 & A \\[6pt] 0 & & & & -A & 1 \end{bmatrix} \begin{bmatrix} \S_1 \\[3pt] \S_2 \\[3pt] \S_3 \\[3pt] \vdots \\[3pt] \S_{N-1} \\[3pt] \S_{N} \end{bmatrix} = \begin{bmatrix} \d_1 \\[3pt] \d_2 \\[3pt] \d_3 \\[3pt] \vdots \\[3pt] \d_{N-1} \\[3pt] \d_{N} \end{bmatrix} $$ where $1$ is the identity matrix and $A$ is an $n\times n$ matrix. The $\S_i$ and $\d_i$ are $n$-component vectors, the $\d_i$ are known and I want to solve for the $\S_i$.
The "brute force" way to solve this is to Flatten
the "vectors of vectors" and ArrayFlatten
the "matrix of matrices", then use LinearSolve
, then use Partition[S,n]
to recover the vectors. But I feel like such systems must not be that uncommon and maybe there is some built in method of doing this.
Flatten
andPartition
. It would be nice to have an option for such a problem built in toLinearSolve
for example. $\endgroup$