Skip to content

Commit

Permalink
removed silly type piracy
Browse files Browse the repository at this point in the history
  • Loading branch information
ExpandingMan committed Aug 22, 2018
1 parent 348f882 commit 40ba800
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
19 changes: 0 additions & 19 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,25 +309,6 @@ function _dot(lhs::AbstractArray{T}, rhs::AbstractArray{S}) where {T,S}
ret
end

# this is a generic fallback from stdlib LinearAlgebra that's needed for tests to pass on 0.6
# for example, dot(::Array{Float64,3}, ::Array{Int,3}) is not defined in 0.6
if VERSION < v"0.7-"
function Base.dot(x::AbstractArray, y::AbstractArray)
lx = length(x)
if lx != length(y)
throw(DimensionMismatch("first array has length $(lx) which does not match the length of the second, $(length(y))."))
end
if lx == 0
return dot(zero(eltype(x)), zero(eltype(y)))
end
s = zero(dot(first(x), first(y)))
for (Ix, Iy) in zip(eachindex(x), eachindex(y))
@inbounds s += dot(x[Ix], y[Iy])
end
s
end
end

###############################################################################
# A bunch of operator junk to make matrix multiplication and friends act
# reasonably sane with JuMP types
Expand Down
4 changes: 2 additions & 2 deletions test/operator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,8 @@ end
for i in 1:2, j in 1:2
setvalue(y[i,j], 1)
end
@test isapprox(dot(c, getvalue(x)), 6.0)
@test isapprox(dot(A, getvalue(y)), 10.0)
@test isapprox(dot(convert(Array{Float64}, c), getvalue(x)), 6.0)
@test isapprox(dot(convert(Array{Float64}, A), getvalue(y)), 10.0)

# https://github.com/JuliaOpt/JuMP.jl/issues/656
issue656 = Model()
Expand Down

0 comments on commit 40ba800

Please sign in to comment.