Kronecker.jl
Kronecker.jl copied to clipboard
Kronecker power for integer one
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?
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