Skip to content

Commit 6f61dc3

Browse files
fix #178 (#343)
* fix #178 * Update FillArraysSparseArraysExt.jl * try to fix --------- Co-authored-by: Sheehan Olver <[email protected]>
1 parent 00492dd commit 6f61dc3

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

ext/FillArraysSparseArraysExt.jl

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
module FillArraysSparseArraysExt
22

33
using SparseArrays
4-
using FillArrays
5-
using FillArrays: RectDiagonalFill, RectOrDiagonalFill, ZerosVector, ZerosMatrix, getindex_value
4+
using SparseArrays: SparseVectorUnion
65
import Base: convert, kron
6+
using FillArrays
7+
using FillArrays: RectDiagonalFill, RectOrDiagonalFill, ZerosVector, ZerosMatrix, getindex_value, AbstractFillVector, _fill_dot
78
# Specifying the full namespace is necessary because of https://github.com/JuliaLang/julia/issues/48533
89
# See https://github.com/JuliaStats/LogExpFunctions.jl/pull/63
910
using FillArrays.LinearAlgebra
11+
import LinearAlgebra: dot, kron, I
1012

1113
##################
1214
## Sparse arrays
@@ -58,4 +60,12 @@ end
5860
# TODO: remove in v2.0
5961
@deprecate kron(E1::RectDiagonalFill, E2::RectDiagonalFill) kron(sparse(E1), sparse(E2))
6062

63+
# Ambiguity. see #178
64+
if VERSION >= v"1.8"
65+
dot(x::AbstractFillVector, y::SparseVectorUnion) = _fill_dot(x, y)
66+
else
67+
dot(x::AbstractFillVector{<:Number}, y::SparseVectorUnion{<:Number}) = _fill_dot(x, y)
68+
end
69+
70+
6171
end # module

test/runtests.jl

+8-3
Original file line numberDiff line numberDiff line change
@@ -1438,9 +1438,14 @@ end
14381438
@test axes(E .+ E) === axes(E)
14391439
end
14401440

1441-
@testset "Issue #31" begin
1442-
@test convert(SparseMatrixCSC{Float64,Int64}, Zeros{Float64}(3, 3)) == spzeros(3, 3)
1443-
@test sparse(Zeros(4, 2)) == spzeros(4, 2)
1441+
@testset "Issues" begin
1442+
@testset "#31" begin
1443+
@test convert(SparseMatrixCSC{Float64,Int64}, Zeros{Float64}(3, 3)) == spzeros(3, 3)
1444+
@test sparse(Zeros(4, 2)) == spzeros(4, 2)
1445+
end
1446+
@testset "#178" begin
1447+
@test Zeros(10)'*spzeros(10) == 0
1448+
end
14441449
end
14451450

14461451
@testset "Adjoint/Transpose/permutedims" begin

0 commit comments

Comments
 (0)