diff --git a/ext/FillArraysSparseArraysExt.jl b/ext/FillArraysSparseArraysExt.jl index a33b89d8..6021296b 100644 --- a/ext/FillArraysSparseArraysExt.jl +++ b/ext/FillArraysSparseArraysExt.jl @@ -1,12 +1,14 @@ module FillArraysSparseArraysExt using SparseArrays -using FillArrays -using FillArrays: RectDiagonalFill, RectOrDiagonalFill, ZerosVector, ZerosMatrix, getindex_value +using SparseArrays: SparseVectorUnion import Base: convert, kron +using FillArrays +using FillArrays: RectDiagonalFill, RectOrDiagonalFill, ZerosVector, ZerosMatrix, getindex_value, AbstractFillVector, _fill_dot # Specifying the full namespace is necessary because of https://github.com/JuliaLang/julia/issues/48533 # See https://github.com/JuliaStats/LogExpFunctions.jl/pull/63 using FillArrays.LinearAlgebra +import LinearAlgebra: dot, kron, I ################## ## Sparse arrays @@ -58,4 +60,12 @@ end # TODO: remove in v2.0 @deprecate kron(E1::RectDiagonalFill, E2::RectDiagonalFill) kron(sparse(E1), sparse(E2)) +# Ambiguity. see #178 +if VERSION >= v"1.8" + dot(x::AbstractFillVector, y::SparseVectorUnion) = _fill_dot(x, y) +else + dot(x::AbstractFillVector{<:Number}, y::SparseVectorUnion{<:Number}) = _fill_dot(x, y) +end + + end # module diff --git a/test/runtests.jl b/test/runtests.jl index 41c518cd..b3474f05 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1438,9 +1438,14 @@ end @test axes(E .+ E) === axes(E) end -@testset "Issue #31" begin - @test convert(SparseMatrixCSC{Float64,Int64}, Zeros{Float64}(3, 3)) == spzeros(3, 3) - @test sparse(Zeros(4, 2)) == spzeros(4, 2) +@testset "Issues" begin + @testset "#31" begin + @test convert(SparseMatrixCSC{Float64,Int64}, Zeros{Float64}(3, 3)) == spzeros(3, 3) + @test sparse(Zeros(4, 2)) == spzeros(4, 2) + end + @testset "#178" begin + @test Zeros(10)'*spzeros(10) == 0 + end end @testset "Adjoint/Transpose/permutedims" begin