@@ -42,8 +42,8 @@ represent objects in 𝕜-linear monoidal categories.
4242abstract type VectorSpace end
4343
4444"""
45- field(a) -> Type{𝔽<: Field}
46- field(::Type{T}) -> Type{𝔽<: Field}
45+ field(a) -> Type{𝔽 <: Field}
46+ field(::Type{T}) -> Type{𝔽 <: Field}
4747
4848Return the type of field over which object `a` (e.g. a vector space or a tensor) is defined.
4949Also works in type domain.
@@ -119,12 +119,12 @@ Return the sum of all degeneracy dimensions of the vector space `V`.
119119reduceddim (V:: ElementarySpace ) = sum (Base. Fix1 (dim, V), sectors (V); init = 0 )
120120
121121"""
122- unitspace(V::S) where {S<: ElementarySpace} -> S
122+ unitspace(V::S) where {S <: ElementarySpace} -> S
123123
124124Return the corresponding vector space of type `S` that represents the trivial
125125one-dimensional space, i.e. the space that is isomorphic to the corresponding field. Note
126126that this is different from `one(V::S)`, which returns the empty product space
127- `ProductSpace{S,0}(())`. `Base.oneunit` falls back to `unitspace`. For vector spaces
127+ `ProductSpace{S, 0}(())`. `Base.oneunit` falls back to `unitspace`. For vector spaces
128128of type `GradedSpace{I}` where `Sector` `I` has a semi-simple unit structure, this
129129returns a multi-dimensional space corresponding to all unit sectors in `I`.
130130"""
@@ -133,7 +133,7 @@ Base.oneunit(V::ElementarySpace) = unitspace(V)
133133Base. oneunit (:: Type{V} ) where {V <: ElementarySpace } = unitspace (V)
134134
135135"""
136- zerospace(V::S) where {S<: ElementarySpace} -> S
136+ zerospace(V::S) where {S <: ElementarySpace} -> S
137137
138138Return the corresponding vector space of type `S` that represents the zero-dimensional or empty space.
139139This is, with a slight abuse of notation, the zero element of the direct sum of vector spaces.
@@ -144,66 +144,66 @@ Base.zero(V::ElementarySpace) = zerospace(V)
144144Base. zero (:: Type{V} ) where {V <: ElementarySpace } = zerospace (V)
145145
146146"""
147- leftunitspace(V::ElementarySpace) -> ElementarySpace
147+ leftunitspace(V::S) where {S <: ElementarySpace} -> S
148148
149149Return the corresponding vector space of type `ElementarySpace` that represents the trivial
150150one-dimensional space, i.e. the space that is isomorphic to the corresponding field. For vector spaces
151151of type `GradedSpace{I}`, this corresponds to the unique left unit of the objects in `Sector` `I` present
152152in the vector space.
153153"""
154- function leftunitspace (S :: ElementarySpace )
155- I = sectortype (S )
154+ function leftunitspace (V :: ElementarySpace )
155+ I = sectortype (V )
156156 if UnitStyle (I) isa SimpleUnit
157- return unitspace (typeof (S ))
157+ return unitspace (typeof (V ))
158158 else
159- ! isempty (sectors (S )) || throw (ArgumentError (" Cannot determine type of empty space" ))
160- _allequal (leftunit, sectors (S )) ||
161- throw (ArgumentError (" sectors of $S do not have the same left unit" ))
159+ ! isempty (sectors (V )) || throw (ArgumentError (" Cannot determine type of empty space" ))
160+ _allequal (leftunit, sectors (V )) ||
161+ throw (ArgumentError (" sectors of $V do not have the same left unit" ))
162162
163- sector = leftunit (first (sectors (S )))
164- return spacetype (S )(sector => 1 )
163+ sector = leftunit (first (sectors (V )))
164+ return spacetype (V )(sector => 1 )
165165 end
166166end
167167
168168"""
169- rightunitspace(S::ElementarySpace) -> ElementarySpace
169+ rightunitspace(V::S) where {S <: ElementarySpace} -> S
170170
171171Return the corresponding vector space of type `ElementarySpace` that represents the trivial
172172one-dimensional space, i.e. the space that is isomorphic to the corresponding field. For vector spaces
173173of type `GradedSpace{I}`, this corresponds to the right unit of the objects in `Sector` `I` present
174174in the vector space.
175175"""
176- function rightunitspace (S :: ElementarySpace )
177- I = sectortype (S )
176+ function rightunitspace (V :: ElementarySpace )
177+ I = sectortype (V )
178178 if UnitStyle (I) isa SimpleUnit
179- return unitspace (typeof (S ))
179+ return unitspace (typeof (V ))
180180 else
181- ! isempty (sectors (S )) || throw (ArgumentError (" Cannot determine type of empty space" ))
182- _allequal (rightunit, sectors (S )) ||
183- throw (ArgumentError (" sectors of $S do not have the same right unit" ))
181+ ! isempty (sectors (V )) || throw (ArgumentError (" Cannot determine type of empty space" ))
182+ _allequal (rightunit, sectors (V )) ||
183+ throw (ArgumentError (" sectors of $V do not have the same right unit" ))
184184
185- sector = rightunit (first (sectors (S )))
186- return spacetype (S )(sector => 1 )
185+ sector = rightunit (first (sectors (V )))
186+ return spacetype (V )(sector => 1 )
187187 end
188188end
189189
190190"""
191- isunitspace(S::ElementarySpace) -> Bool
191+ isunitspace(V::S) where {S <: ElementarySpace} -> Bool
192192
193- Return whether the elementary space `S ` is a unit space, i.e. is isomorphic to the
193+ Return whether the elementary space `V ` is a unit space, i.e. is isomorphic to the
194194trivial one-dimensional space. For vector spaces of type `GradedSpace{I}` where `Sector` `I` has a
195- semi-simple unit structure, this returns `true` if `S ` is isomorphic to either the left, right or
195+ semi-simple unit structure, this returns `true` if `V ` is isomorphic to either the left, right or
196196semi-simple unit space.
197197"""
198- function isunitspace (S :: ElementarySpace ) # TODO : add tests for this
199- I = sectortype (S )
198+ function isunitspace (V :: ElementarySpace ) # TODO : add tests for this
199+ I = sectortype (V )
200200 return if isa (UnitStyle (I), SimpleUnit)
201- isisomorphic (S , unitspace (S ))
201+ isisomorphic (V , unitspace (V ))
202202 else
203203 try
204- isisomorphic (S , unitspace (S )) ||
205- isisomorphic (S , leftunitspace (S )) ||
206- isisomorphic (S , rightunitspace (S ))
204+ isisomorphic (V , unitspace (V )) ||
205+ isisomorphic (V , leftunitspace (V )) ||
206+ isisomorphic (V , rightunitspace (V ))
207207 catch e
208208 if isa (e, ArgumentError)
209209 return false
0 commit comments