Skip to content

Commit

Permalink
Mixinf Hamiltonian with other matrices introduces 120+ ambiguities, l…
Browse files Browse the repository at this point in the history
…et's not do that.
  • Loading branch information
kellertuer committed Jan 21, 2024
1 parent 4a149fc commit ef55fa7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
6 changes: 0 additions & 6 deletions src/manifolds/Hamiltonian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@ function Matrix(A::Hamiltonian)
end

Base.:*(H::Hamiltonian, K::Hamiltonian) = Hamiltonian(H.value * K.value)
Base.:*(H::Hamiltonian, A::AbstractMatrix) = H.value * A
Base.:*(A::AbstractMatrix, K::Hamiltonian) = A * K.value
Base.:+(H::Hamiltonian, K::Hamiltonian) = Hamiltonian(H.value .+ K.value)
Base.:+(H::Hamiltonian, A::AbstractMatrix) = H.value .+ A
Base.:+(A::AbstractMatrix, K::Hamiltonian) = A .+ K.value
Base.:-(H::Hamiltonian, K::Hamiltonian) = Hamiltonian(H.value .- K.value)

Check warning on line 33 in src/manifolds/Hamiltonian.jl

View check run for this annotation

Codecov / codecov/patch

src/manifolds/Hamiltonian.jl#L31-L33

Added lines #L31 - L33 were not covered by tests
Base.:-(H::Hamiltonian, A::AbstractMatrix) = H.value .- A
Base.:-(A::AbstractMatrix, K::Hamiltonian) = A .- K.value

function show(io::IO, A::Hamiltonian)
return print(io, "Hamiltonian($(A.value))")

Check warning on line 36 in src/manifolds/Hamiltonian.jl

View check run for this annotation

Codecov / codecov/patch

src/manifolds/Hamiltonian.jl#L35-L36

Added lines #L35 - L36 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion src/manifolds/SymplecticStiefel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Check whether `p` is a valid point on the [`SymplecticStiefel`](@ref),
``\mathrm{SpSt}(2n, 2k)`` manifold, that is ``p^{+}p`` is the identity,
``(⋅)^+`` denotes the [`symplectic_inverse`](@ref).
"""
function check_point(M::SymplecticStiefel{<:Any,ℝ}, p::T; kwargs...) where {T}
function check_point(M::SymplecticStiefel{<:Any,ℝ}, p; kwargs...)

Check warning on line 113 in src/manifolds/SymplecticStiefel.jl

View check run for this annotation

Codecov / codecov/patch

src/manifolds/SymplecticStiefel.jl#L113

Added line #L113 was not covered by tests
# Perform check that the matrix lives on the real symplectic manifold:
if !isapprox(inv(M, p) * p, I; kwargs...)

Check warning on line 115 in src/manifolds/SymplecticStiefel.jl

View check run for this annotation

Codecov / codecov/patch

src/manifolds/SymplecticStiefel.jl#L115

Added line #L115 was not covered by tests
return DomainError(
Expand Down
3 changes: 2 additions & 1 deletion test/ambiguities.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include("header.jl")
"""
has_type_in_signature(sig, T::Type)
Expand All @@ -11,7 +12,7 @@ function has_type_in_signature(sig, T::Type)
end

@testset "Ambiguities" begin
if VERSION.prerelease == () && !Sys.iswindows() && VERSION < v"1.10.0"
if VERSION.prerelease == () && !Sys.iswindows() && VERSION < v"1.11.0"
mbs = Test.detect_ambiguities(ManifoldsBase)
# Interims solution until we follow what was proposed in
# https://discourse.julialang.org/t/avoid-ambiguities-with-individual-number-element-identity/62465/2
Expand Down

0 comments on commit ef55fa7

Please sign in to comment.