Skip to content

Commit

Permalink
fixed wrong dot extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ExpandingMan committed Aug 22, 2018
1 parent 811edc3 commit edd8534
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/affexpr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ coeftype(::GenericAffExpr{C,V}) where {C,V} = C
# variables must be ∈ ℝ but coeffs can be ∈ ℂ
Compat.adjoint(a::GenericAffExpr{<:Real}) = a
function Compat.adjoint(a::GenericAffExpr)
GenericAffExpr(a.vars, [z' for z a.coeffs], a.constant')
GenericAffExpr(a.vars, adjoint.(a.coeffs), a.constant')
end

Base.zero(::Type{GenericAffExpr{C,V}}) where {C,V} = GenericAffExpr{C,V}(V[],C[],zero(C))
Expand Down
12 changes: 6 additions & 6 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ Compat.LinearAlgebra.dot(lhs::JuMPTypes, rhs::JuMPTypes) = lhs*rhs
Compat.LinearAlgebra.dot(lhs::JuMPTypes, rhs::Number) = lhs*rhs
Compat.LinearAlgebra.dot(lhs::Number, rhs::JuMPTypes) = lhs*rhs

Compat.dot(lhs::AbstractVector{T},rhs::AbstractVector{S}) where {T<:JuMPTypes,S<:JuMPTypes} = _dot(lhs,rhs)
Compat.dot(lhs::AbstractVector{T},rhs::AbstractVector{S}) where {T<:JuMPTypes,S} = _dot(lhs,rhs)
Compat.dot(lhs::AbstractVector{T},rhs::AbstractVector{S}) where {T,S<:JuMPTypes} = _dot(lhs,rhs)
Compat.LinearAlgebra.dot(lhs::AbstractVector{T},rhs::AbstractVector{S}) where {T<:JuMPTypes,S<:JuMPTypes} = _dot(lhs,rhs)
Compat.LinearAlgebra.dot(lhs::AbstractVector{T},rhs::AbstractVector{S}) where {T<:JuMPTypes,S} = _dot(lhs,rhs)
Compat.LinearAlgebra.dot(lhs::AbstractVector{T},rhs::AbstractVector{S}) where {T,S<:JuMPTypes} = _dot(lhs,rhs)

Compat.dot(lhs::AbstractArray{T,N},rhs::AbstractArray{S,N}) where {T<:JuMPTypes,S<:JuMPTypes,N} = _dot(lhs,rhs)
Compat.dot(lhs::AbstractArray{T,N},rhs::AbstractArray{S,N}) where {T<:JuMPTypes,S,N} = _dot(lhs,rhs)
Compat.dot(lhs::AbstractArray{T,N},rhs::AbstractArray{S,N}) where {T,S<:JuMPTypes,N} = _dot(lhs,rhs)
Compat.LinearAlgebra.dot(lhs::AbstractArray{T,N},rhs::AbstractArray{S,N}) where {T<:JuMPTypes,S<:JuMPTypes,N} = _dot(lhs,rhs)
Compat.LinearAlgebra.dot(lhs::AbstractArray{T,N},rhs::AbstractArray{S,N}) where {T<:JuMPTypes,S,N} = _dot(lhs,rhs)
Compat.LinearAlgebra.dot(lhs::AbstractArray{T,N},rhs::AbstractArray{S,N}) where {T,S<:JuMPTypes,N} = _dot(lhs,rhs)

function _dot(lhs::AbstractArray{T}, rhs::AbstractArray{S}) where {T,S}
size(lhs) == size(rhs) || error("Incompatible dimensions")
Expand Down
2 changes: 1 addition & 1 deletion src/quadexpr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ coeftype(::GenericQuadExpr{C,V}) where {C,V} = C
# variables are ∈ ℝ but coeffs can be ∈ ℂ
Compat.adjoint(q::GenericQuadExpr{<:Real}) = q
function Compat.adjoint(q::GenericQuadExpr)
GenericQuadExpr(q.qvars1, q.qvars2, [z' for z q.qcoeffs], aff')
GenericQuadExpr(q.qvars1, q.qvars2, adjoint.(q.qcoeffs), aff')
end

Base.isempty(q::GenericQuadExpr) = (length(q.qvars1) == 0 && isempty(q.aff))
Expand Down
4 changes: 2 additions & 2 deletions test/operator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if VERSION ≥ v"0.7-"
end


@testset "Operator overloads" begin
#@testset "Operator overloads" begin

_lt(x,y) = (x.col < y.col)
function sort_expr!(x::AffExpr)
Expand Down Expand Up @@ -899,4 +899,4 @@ end
@test z[i].a == y[i].a == a
end
end
end
#end

0 comments on commit edd8534

Please sign in to comment.