Skip to content

Store identity matrices in KroneckerSums #62

@elisno

Description

@elisno

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions