230230Return a tensor product of zero spaces of type `S`, i.e. this is the unit object under the
231231tensor product operation, such that `V ⊗ one(V) == V`.
232232"""
233+ # TODO : unit(V::S)?
233234Base. one (V:: VectorSpace ) = one (typeof (V))
234235Base. one (:: Type{<:ProductSpace{S}} ) where {S <: ElementarySpace } = ProductSpace {S, 0} (())
235236Base. one (:: Type{S} ) where {S <: ElementarySpace } = ProductSpace {S, 0} (())
@@ -240,8 +241,8 @@ function Base.literal_pow(::typeof(^), V::ElementarySpace, p::Val{N}) where {N}
240241 return ProductSpace {typeof(V), N} (ntuple (n -> V, p))
241242end
242243
243- fuse (P:: ProductSpace{S, 0} ) where {S <: ElementarySpace } = oneunit (S)
244- fuse (P:: ProductSpace{S} ) where {S <: ElementarySpace } = fuse (P. spaces... )
244+ fuse (P:: ProductSpace{S,0} ) where {S<: ElementarySpace } = unitspace (S)
245+ fuse (P:: ProductSpace{S} ) where {S<: ElementarySpace } = fuse (P. spaces... )
245246
246247"""
247248 insertleftunit(P::ProductSpace, i::Int=length(P) + 1; conj=false, dual=false)
@@ -252,10 +253,9 @@ More specifically, adds a left monoidal unit or its dual.
252253
253254See also [`insertrightunit`](@ref insertrightunit(::ProductSpace, ::Val{i}) where {i}), [`removeunit`](@ref removeunit(::ProductSpace, ::Val{i}) where {i}).
254255"""
255- function insertleftunit (
256- P:: ProductSpace , :: Val{i} = Val (length (P) + 1 ); conj:: Bool = false , dual:: Bool = false
257- ) where {i}
258- u = oneunit (spacetype (P))
256+ function insertleftunit (P:: ProductSpace , :: Val{i} = Val (length (P) + 1 );
257+ conj:: Bool = false , dual:: Bool = false ) where {i}
258+ u = unitspace (spacetype (P))
259259 if dual
260260 u = TensorKit. dual (u)
261261 end
@@ -274,10 +274,9 @@ More specifically, adds a right monoidal unit or its dual.
274274
275275See also [`insertleftunit`](@ref insertleftunit(::ProductSpace, ::Val{i}) where {i}), [`removeunit`](@ref removeunit(::ProductSpace, ::Val{i}) where {i}).
276276"""
277- function insertrightunit (
278- P:: ProductSpace , :: Val{i} = Val (length (P)); conj:: Bool = false , dual:: Bool = false
279- ) where {i}
280- u = oneunit (spacetype (P))
277+ function insertrightunit (P:: ProductSpace , :: Val{i} = Val (length (P));
278+ conj:: Bool = false , dual:: Bool = false ) where {i}
279+ u = unitspace (spacetype (P))
281280 if dual
282281 u = TensorKit. dual (u)
283282 end
@@ -299,7 +298,7 @@ and [`insertrightunit`](@ref insertrightunit(::ProductSpace, ::Val{i}) where {i}
299298"""
300299function removeunit (P:: ProductSpace , :: Val{i} ) where {i}
301300 1 ≤ i ≤ length (P) || _boundserror (P, i)
302- isisomorphic (P[i], oneunit (P[i])) || _nontrivialspaceerror (P, i)
301+ isisomorphic (P[i], unitspace (P[i])) || _nontrivialspaceerror (P, i)
303302 return ProductSpace {spacetype(P)} (TupleTools. deleteat (P. spaces, i))
304303end
305304
@@ -326,8 +325,8 @@ function Base.promote_rule(::Type{S}, ::Type{<:ProductSpace{S}}) where {S <: Ele
326325end
327326
328327# ProductSpace to ElementarySpace
329- Base. convert (:: Type{S} , P:: ProductSpace{S, 0} ) where {S <: ElementarySpace } = oneunit (S)
330- Base. convert (:: Type{S} , P:: ProductSpace{S} ) where {S <: ElementarySpace } = fuse (P. spaces... )
328+ Base. convert (:: Type{S} , P:: ProductSpace{S,0} ) where {S<: ElementarySpace } = unitspace (S)
329+ Base. convert (:: Type{S} , P:: ProductSpace{S} ) where {S<: ElementarySpace } = fuse (P. spaces... )
331330
332331# ElementarySpace to ProductSpace
333332Base. convert (:: Type{<:ProductSpace} , V:: S ) where {S <: ElementarySpace } = ⊗ (V)
0 commit comments