Skip to content

Commit

Permalink
fix more ambiguity warnings in julia 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Jan 5, 2024
1 parent 0c86fe1 commit afd1f66
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
7 changes: 5 additions & 2 deletions src/spaces/cartesianspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ Base.:^(::RealNumbers, d::Int) = CartesianSpace(d)

# Corresponding methods:
#------------------------
dim(V::CartesianSpace, s::Trivial = Trivial()) = V.d
Base.axes(V::CartesianSpace) = Base.OneTo(dim(V))
dim(V::CartesianSpace, ::Trivial=Trivial()) = V.d
Base.axes(V::CartesianSpace, ::Trivial=Trivial()) = Base.OneTo(dim(V))
hassector(V::CartesianSpace, ::Trivial) = dim(V) != 0
sectors(V::CartesianSpace) = OneOrNoneIterator(dim(V) != 0, Trivial())
sectortype(::Type{CartesianSpace}) = Trivial

Base.oneunit(::Type{CartesianSpace}) = CartesianSpace(1)
(V₁::CartesianSpace, V₂::CartesianSpace) = CartesianSpace(V₁.d + V₂.d)
Expand Down
7 changes: 5 additions & 2 deletions src/spaces/complexspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ Base.:^(::ComplexNumbers, d::Int) = ComplexSpace(d)

# Corresponding methods:
#------------------------
dim(V::ComplexSpace, s::Trivial = Trivial()) = V.d
dim(V::ComplexSpace, s::Trivial=Trivial()) = V.d
isdual(V::ComplexSpace) = V.dual
Base.axes(V::ComplexSpace) = Base.OneTo(dim(V))
Base.axes(V::ComplexSpace, ::Trivial=Trivial()) = Base.OneTo(dim(V))
hassector(V::ComplexSpace, ::Trivial) = dim(V) != 0
sectors(V::ComplexSpace) = OneOrNoneIterator(dim(V) != 0, Trivial())
sectortype(::Type{ComplexSpace}) = Trivial

Base.conj(V::ComplexSpace) = ComplexSpace(dim(V), !isdual(V))

Expand Down
7 changes: 5 additions & 2 deletions src/spaces/generalspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ function GeneralSpace{𝕜}(d::Int=0; dual::Bool=false, conj::Bool=false) where
return GeneralSpace{𝕜}(d, dual, conj)
end

dim(V::GeneralSpace, s::Trivial = Trivial()) = V.d
dim(V::GeneralSpace, s::Trivial=Trivial()) = V.d
isdual(V::GeneralSpace) = V.dual
isconj(V::GeneralSpace) = V.conj

Base.axes(V::GeneralSpace) = Base.OneTo(dim(V))
Base.axes(V::GeneralSpace, ::Trivial=Trivial()) = Base.OneTo(dim(V))
hassector(V::GeneralSpace, ::Trivial) = dim(V) != 0
sectors(V::GeneralSpace) = OneOrNoneIterator(dim(V) != 0, Trivial())
sectortype(::Type{GeneralSpace}) = Trivial

field(::Type{GeneralSpace{𝕜}}) where {𝕜} = 𝕜
InnerProductStyle(::Type{<:GeneralSpace}) = NoInnerProduct()
Expand Down
6 changes: 2 additions & 4 deletions src/spaces/vectorspaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,23 +212,21 @@ Return the type of sector over which object `a` (e.g. a representation space or
defined. Also works in type domain.
"""
sectortype(V::VectorSpace) = sectortype(typeof(V))
sectortype(::Type{<:ElementarySpace}) = Trivial

"""
hassector(V::VectorSpace, a::Sector) -> Bool
Return whether a vector space `V` has a subspace corresponding to sector `a` with non-zero
dimension, i.e. `dim(V, a) > 0`.
"""
hassector(V::ElementarySpace, ::Trivial) = dim(V) != 0
Base.axes(V::ElementarySpace, ::Trivial) = axes(V)
function hassector end

"""
sectors(V::ElementarySpace)
Return an iterator over the different sectors of `V`.
"""
sectors(V::ElementarySpace) = OneOrNoneIterator(dim(V) != 0, Trivial())
function sectors end

# Composite vector spaces
#-------------------------
Expand Down

0 comments on commit afd1f66

Please sign in to comment.