Should the KroneckerSum have extra fields for the identity matrices?
Something like the following:
struct KroneckerSum{T<:Any, TA<:AbstractMatrix, TB<:AbstractMatrix} <: AbstractKroneckerSum{T}
A::TA
B::TB
IA::TA
IB::TB
function KroneckerSum(A::AbstractMatrix{T},
B::AbstractMatrix{V}) where {T, V}
(issquare(A) && issquare(B)) || throw(DimensionMismatch(
"KroneckerSum only applies to square matrices"))
return new{promote_type(T, V), typeof(A), typeof(B)}(A, B, oneunit(A), oneunit(B))
end
end
IA and IB would be used in Base.collect(K::KroneckerSum).
Then it would make sense to "reuse" a KroneckerSum, when repeated collections are required.
It would also complement in-place versions of collect with kron! (see #61).
Should the
KroneckerSumhave extra fields for the identity matrices?Something like the following:
IAandIBwould be used inBase.collect(K::KroneckerSum).Then it would make sense to "reuse" a
KroneckerSum, when repeated collections are required.It would also complement in-place versions of
collectwithkron!(see #61).