Skip to content

Commit abdeadc

Browse files
authored
Remove kron piracy (#119)
* rm `kron` pirated method * add test
1 parent ce89efc commit abdeadc

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/operations/kronecker.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,14 @@ function LinearAlgebra.kron(
5555
return C
5656
end
5757

58-
LinearAlgebra.kron!(C::GBVecOrMat, A::VecMatOrTrans, B::GBArrayOrTranspose, op = *; kwargs...) =
58+
LinearAlgebra.kron!(C::GBVecOrMat, A::VecMatOrTrans, B::GBArrayOrTranspose, op = *; kwargs...) =
5959
@_densepack A kron!(C, A, B, op; kwargs...)
60-
LinearAlgebra.kron!(C::GBVecOrMat, A::GBArrayOrTranspose, B::VecMatOrTrans, op = *; kwargs...) =
60+
LinearAlgebra.kron!(C::GBVecOrMat, A::GBArrayOrTranspose, B::VecMatOrTrans, op = *; kwargs...) =
6161
@_densepack B kron!(C, A, B, op; kwargs...)
62-
LinearAlgebra.kron!(C::GBVecOrMat, A::VecMatOrTrans, B::VecMatOrTrans, op = *; kwargs...) =
62+
LinearAlgebra.kron!(C::GBVecOrMat, A::VecMatOrTrans, B::VecMatOrTrans, op = *; kwargs...) =
6363
@_densepack A B kron!(C, A, B, op; kwargs...)
6464

65-
LinearAlgebra.kron(A::VecMatOrTrans, B::GBArrayOrTranspose, op = *; kwargs...) =
65+
LinearAlgebra.kron(A::VecMatOrTrans, B::GBArrayOrTranspose, op = *; kwargs...) =
6666
@_densepack A kron(A, B, op; kwargs...)
67-
LinearAlgebra.kron(A::GBArrayOrTranspose, B::VecMatOrTrans, op = *; kwargs...) =
67+
LinearAlgebra.kron(A::GBArrayOrTranspose, B::VecMatOrTrans, op = *; kwargs...) =
6868
@_densepack B kron(A, B, op; kwargs...)
69-
LinearAlgebra.kron(A::VecMatOrTrans, B::VecMatOrTrans, op = *; kwargs...) =
70-
@_densepack A B kron(A, B, op; kwargs...)

test/operations/kron.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@
1111
o2 = kron(m1, n1; mask, desc=Descriptor(structural_mask=true, complement_mask=true))
1212
@test o2[20, 5] === getfill(o2) #We don't want values in masked out area
1313
@test o2[1:2:15, :] == o1[1:2:15, :] #The rest should match, test indexing too.
14+
15+
# Ensure we don't break usual `kron`
16+
# https://github.com/JuliaSparse/SuiteSparseGraphBLAS.jl/issues/118
17+
A = zeros(2,3)
18+
B = rand(3,4)
19+
@test kron(A,B) isa Matrix{Float64}
1420
end

0 commit comments

Comments
 (0)