Skip to content

Commit

Permalink
Fix for Julia v1.0 and Julia v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Dec 16, 2019
1 parent e5e9691 commit 137f609
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/dispatch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ function Base.:-(A::LinearAlgebra.Hermitian{<:AbstractMutable})
return LinearAlgebra.Hermitian(-parent(A), LinearAlgebra.sym_uplo(A.uplo))
end

# Needed for Julia v1.0, otherwise, `broadcast(*, α, A)` gives a `Array` and
# not a `Symmetric`.
function Base.:*::Number, A::LinearAlgebra.Symmetric{<:AbstractMutable})
return LinearAlgebra.Symmetric* parent(A), LinearAlgebra.sym_uplo(A.uplo))
end
function Base.:*::Number, A::LinearAlgebra.Hermitian{<:AbstractMutable})
return LinearAlgebra.Hermitian* parent(A), LinearAlgebra.sym_uplo(A.uplo))
end


# These three have specific methods that just redirect to `Matrix{T}` which
# does not work, e.g. if `zero(T)` has a different type than `T`.
function Base.Matrix(x::LinearAlgebra.Tridiagonal{T}) where T<:AbstractMutable
Expand Down
1 change: 1 addition & 0 deletions test/dummy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MA.promote_operation(::typeof(*), ::Type{DummyBigInt}, ::Type{DummyBigInt}) = Du
Base.convert(::Type{DummyBigInt}, x::Int) = DummyBigInt(x)
MA.isequal_canonical(x::DummyBigInt, y::DummyBigInt) = x.data == y.data
Base.iszero(x::DummyBigInt) = iszero(x.data)
Base.isone(x::DummyBigInt) = isone(x.data)
# We don't define == to tests that implementation of MA can pass the tests without defining ==.
# This is the case for MOI functions for instance.
# For th same reason, we only define `zero` and `one` for `Type{DummyBigInt}`, not for `DummyBigInt`.
Expand Down

0 comments on commit 137f609

Please sign in to comment.