JuliaSparse / SuiteSparseGraphBLAS.jl

Sparse, General Linear Algebra for Graphs!
MIT License
102 stars 17 forks source link

Piracy of `kron` breaks `kron(::Matrix,::Matrix)` #118

Closed ericphanson closed 1 year ago

ericphanson commented 1 year ago

https://github.com/JuliaSparse/SuiteSparseGraphBLAS.jl/blob/ce89efca856aa1afe65c5913423eb87ac4239f87/src/operations/kronecker.jl#L69

This causes code like

In [24]: A = rand(ComplexF64, 2, 2)
Out[24]: 2×2 Matrix{ComplexF64}:
 0.469153+0.874823im  0.101443+0.0576494im
 0.333506+0.167122im  0.931151+0.260175im

In [25]: B = rand(ComplexF64, 3, 3)
Out[25]: 3×3 Matrix{ComplexF64}:
 0.822419+0.345264im   0.858039+0.306525im   0.47221+0.411678im
 0.369399+0.543773im  0.0729842+0.709066im  0.643159+0.0964229im
  0.34873+0.939529im   0.222741+0.839004im  0.939052+0.274967im

In [26]: kron(A,B)
ERROR: MethodError: no method matching (SuiteSparseGraphBLAS.GBShallowMatrix{ComplexF64})(::Int64, ::Int64; fill::ComplexF64)

Closest candidates are:
  (SuiteSparseGraphBLAS.GBShallowMatrix{T})(::Any, ::F, ::P, ::P, ::P, ::B, ::A) where {T, F, P, B, A} got unsupported keyword argument "fill"
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/types.jl:960
  (SuiteSparseGraphBLAS.GBShallowMatrix{T})(::Any, ::F, ::P, ::P, ::P, ::B, ::A, ::Any) where {T, F, P, B, A} got unsupported keyword argument "fill"
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/types.jl:960

Stacktrace:
 [1] kron(A::SuiteSparseGraphBLAS.GBShallowMatrix{ComplexF64, ComplexF64, StorageOrders.ColMajor(), Vector{Int64}, Vector{Bool}, Matrix{ComplexF64}}, B::SuiteSparseGraphBLAS.GBShallowMatrix{ComplexF64, ComplexF64, StorageOrders.ColMajor(), Vector{Int64}, Vector{Bool}, Matrix{ComplexF64}}, op::Function; mask::Nothing, accum::Nothing, desc::Nothing)
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/operations/kronecker.jl:53
 [2] kron(A::SuiteSparseGraphBLAS.GBShallowMatrix{ComplexF64, ComplexF64, StorageOrders.ColMajor(), Vector{Int64}, Vector{Bool}, Matrix{ComplexF64}}, B::SuiteSparseGraphBLAS.GBShallowMatrix{ComplexF64, ComplexF64, StorageOrders.ColMajor(), Vector{Int64}, Vector{Bool}, Matrix{ComplexF64}}, op::Function)
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/operations/kronecker.jl:42
 [3] kron(A::Matrix{ComplexF64}, B::Matrix{ComplexF64}, op::Function; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/operations/kronecker.jl:69
 [4] kron(A::Matrix{ComplexF64}, B::Matrix{ComplexF64}, op::Function)
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/operations/kronecker.jl:69
 [5] kron(A::Matrix{ComplexF64}, B::Matrix{ComplexF64})
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/operations/kronecker.jl:69
 [6] top-level scope
   @ REPL[26]:1
 [7] top-level scope
   @ ~/.julia/juliaup/julia-1.9.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.9/REPL/src/REPL.jl:1416

to fail. Note none of these are SuiteSparseGraphBLAS types.