Is there a generic function/API to recover the original matrix from a factorization? Eg LinearAlgebra
defines Matrix
in various places, so
A = randn(5, 5)
F = factorize(A)
Matrix(F) # <- is there a generic API here?
works but this fails for generic <:AbstractArray
, eg StaticArrays.SMatrix
which has its own LU
.
Unfortunately, I think it comes down to this line defining a method specifically on LU
. It would be nice if instead factorizations had a method specific for this like
parent(F::LU) = (F.L * F.U)[invperm(F.p),:]
so that it wasn’t necessary to define a bunch of array specific conversions for each factorization.
I realized that simply documenting that an AbstractMatrix
method (which currently exists) should be defined for all results of factorize
would fix this issue for me.
@andreasnoack, what do you think about this?