Entries for November 20, 2017
-
Reshaping Higher Order Linear Systems
$ \newcommand{\BAhat}{\hat{\boldsymbol{A}}} \newcommand{\Buhat}{\hat{\boldsymbol{u}}} \newcommand{\Bbhat}{\hat{\boldsymbol{b}}} $In vectorial problems, we end up with linear systems of higher order, such as
k=1∑Nl=1∑MAijklukl=bij(1)for i=1,…,N and j=1,…,M.
These systems cannot be solved readily with existing software. In order to be able to solve them with existing software, we need to reshape them by defining a matrix of matrices A^ and vector of vectors u^ and b^:
A^A1111⋮A1M11AN111⋮ANM11⋯⋱⋯⋮⋯⋱⋯A111M⋮A1M1MAN11M⋮ANM1M⋯⋱⋯A11N1⋮A1MN1AN1N1⋮ANMN1⋯⋱⋯⋮⋯⋱⋯A11NM⋮A1MNMAN1NM⋮ANMNMu^u11⋮u1M⋮uN1⋮uNM=b^b11⋮b1M⋮bN1⋮bNM(2)This allows us to express the linear system as
A^u^=b^(3)Here, we reshape the system by defining a map id that maps original indices to the reshaped indices
id:={[1,N]×[1,M](i,j)→[1,NM]↦M(i−1)+j(4)where we used 1-based indexing of the arrays. We set
αβ:=id(i,j):=id(k,l)=M(i−1)+j=M(k−1)+l(5)and write
A^αβ=Aijkl,u^β=uklandb^α=bij(6)For reference, the inverse of the index mapping reads
id−1:={[1,NM]α→[1,N]×[1,M]↦(1+(α−mod(α,M))/M,mod(α,M))(7)Thus, we have for our reshaped indices,
ji=mod(α,M)=1+(α−j)/Mandlk=mod(β,M)=1+(β−l)/M(8)Expressed as a regular linear system (3), the higher-order system (1) can be solved with a linear solver such as LAPACK.