Kronecker.jl icon indicating copy to clipboard operation
Kronecker.jl copied to clipboard

Kronecker power for integer one

Open Wu-Chenyang opened this issue 1 year ago • 1 comments

struct KroneckerPower{T,TA<:AbstractMatrix{T}} <: AbstractKroneckerProduct{T}
    A::TA
    pow::Int
    function KroneckerPower(A::AbstractMatrix, pow::Integer)
        @assert pow ≥ 2 "KroneckerPower only makes sense for powers greater than 1"
        return new{eltype(A),typeof(A)}(A, Int(pow))
    end
end

Currently, the Kronecker power is only implemented for integers greater than one, but isn't it natural to have M⊗1 equal to M?

Wu-Chenyang avatar Dec 09 '24 08:12 Wu-Chenyang

It might, but the problem is that M⊗1would be a Matrix rather than a KroneckerProduct, which would be a type instability. I have implemented this in #138

MichielStock avatar Jan 03 '25 09:01 MichielStock