Skip to content

Commit f414486

Browse files
committed
some more vector space changes
1 parent c9ba5bc commit f414486

2 files changed

Lines changed: 17 additions & 21 deletions

File tree

src/spaces/productspace.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Base.axes(P::ProductSpace, n::Int) = axes(P.spaces[n])
6262

6363
dual(P::ProductSpace{<:ElementarySpace, 0}) = P
6464
dual(P::ProductSpace) = ProductSpace(map(dual, reverse(P.spaces)))
65-
66-
# Base.conj(P::ProductSpace) = ProductSpace(map(conj, P.spaces))
65+
Base.conj(P::ProductSpace{<:ElementarySpace, 0}) = P
66+
Base.conj(P::ProductSpace) = ProductSpace(map(conj, P.spaces))
6767

6868
function Base.show(io::IO, P::ProductSpace{S}) where {S <: ElementarySpace}
6969
spaces = P.spaces

src/spaces/vectorspaces.jl

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,9 @@ For vector spaces over the real numbers, it must hold that `conj(V) == V`.
8181
For vector spaces with a Euclidean inner product, it must hold that `conj(V) == dual(V)`.
8282
""" conj(::VectorSpace)
8383

84-
8584
# convenience definitions:
8685
Base.adjoint(V::VectorSpace) = dual(V)
8786

88-
@doc """
89-
isdual(V::ElementarySpace) -> Bool
90-
91-
Return whether an ElementarySpace `V` is normal or rather a dual space.
92-
Always returns `false` for spaces where `V == dual(V)`.
93-
""" isdual(::ElementarySpace)
94-
95-
@doc """
96-
isconj(V::ElementarySpace) -> Bool
97-
98-
Return whether an ElementarySpace `V` is normal or rather the conjugated space.
99-
Always returns `false` for spaces where `V == conj(V)`, i.e. vector spaces over `ℝ`.
100-
""" isconj(::ElementarySpace)
101-
10287
# Hierarchy of elementary vector spaces
10388
#---------------------------------------
10489
"""
@@ -131,6 +116,20 @@ Return the sum of all degeneracy dimensions of the vector space `V`.
131116
"""
132117
reduceddim(V::ElementarySpace) = sum(Base.Fix1(dim, V), sectors(V); init = 0)
133118

119+
@doc """
120+
isdual(V::ElementarySpace) -> Bool
121+
122+
Return whether an ElementarySpace `V` is normal or rather a dual space.
123+
Always returns `false` for spaces where `V == dual(V)`.
124+
""" isdual(::ElementarySpace)
125+
126+
@doc """
127+
isconj(V::ElementarySpace) -> Bool
128+
129+
Return whether an ElementarySpace `V` is normal or rather the conjugated space.
130+
Always returns `false` for spaces where `V == conj(V)`, i.e. vector spaces over `ℝ`.
131+
""" isconj(::ElementarySpace)
132+
134133
"""
135134
unitspace(V::S) where {S<:ElementarySpace} -> S
136135
@@ -164,7 +163,7 @@ Return the corresponding vector space of type `S` that represents the direct sum
164163
spaces `V₁`, `V₂`, ... Note that all the individual spaces should have the same value for
165164
[`isdual`](@ref), as otherwise the direct sum is not defined.
166165
"""
167-
function end
166+
(V₁::S, V₂::S) where {S <: ElementarySpace}
168167
(V₁::ElementarySpace, V₂::ElementarySpace) = (promote(V₁, V₂)...)
169168
(V::Vararg{ElementarySpace}) = foldl(, V)
170169
const oplus =
@@ -267,9 +266,6 @@ InnerProductStyle(::Type{<:VectorSpace}) = NoInnerProduct()
267266
throw(ArgumentError("$fname requires Euclidean inner product"))
268267
end
269268

270-
dual(V::VectorSpace) = dual(InnerProductStyle(V), V)
271-
dual(::EuclideanInnerProduct, V::VectorSpace) = conj(V)
272-
273269
"""
274270
sectortype(a) -> Type{<:Sector}
275271
sectortype(::Type) -> Type{<:Sector}

0 commit comments

Comments
 (0)