I have a large sparse array A
with dimensions $m \times n \times q $. I also have two transformation matrices, B
($n \times n$) and C ($q \times q$) from which I act from the left on A
. So, for instance, I might use
TensorTranspose[
B . TensorTranspose[
C . TensorTranspose[A, {2, 3, 1}],
{2, 3, 1}
],
{2, 3, 1}
]
where the final tensor transpose is there to put the indices back in the correct order at the end.
Now, A
has the property such that $m$ 'rows' (i.e. if I flatten A into an m by n*q matrix) of the transformed matrix are always linear combinations of the original rows. I want to find the subspace of the space spanned by the m 'rows' of the original matrix which are actually invariant under the transformation which I have described above.
My procedure has been as follows:
Perform the transformation as described above
Flatten the original
A
and the transformedA
into m by n*q matrices, and useLinearSolve
to identify the image of each transformed row as a linear combination of the original rows.Form an m by m matrix X using the results of 2, which acts on
A
from the left and captures the original combined action ofB
andC
onA
.Take
Z = NullSpace[X - IdentityMatrix[{m,m}]];
this acts as a projector so thatZ.A
gives the subspace I wanted.
The problem is that the use of LinearSolve
in 2) gets extremely slow (these matrices are generally very large); I feel it should be possible to carry out this process directly using just the matrices B
and C
, since they themselves are sufficient to transform A
, but I can't wrap my head around the required linear algebra.