From aada0b2e628609b1015ebf1861c6f6a409f3d936 Mon Sep 17 00:00:00 2001 From: Lukas <37111893+lkdvos@users.noreply.github.com> Date: Sat, 30 Mar 2024 22:42:55 +0100 Subject: [PATCH] Add unicode alternatives: `otimes` and `oplus` (#109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add otimes as alternative for ⊗ * Add oplus as alternative for ⊕ --- src/TensorKit.jl | 4 ++-- src/sectors/sectors.jl | 4 +++- src/spaces/vectorspaces.jl | 2 ++ src/tensors/linalg.jl | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/TensorKit.jl b/src/TensorKit.jl index 281b5509..e662f9c2 100644 --- a/src/TensorKit.jl +++ b/src/TensorKit.jl @@ -30,14 +30,14 @@ export TruncationScheme export SpaceMismatch, SectorMismatch, IndexError # error types # general vector space methods -export space, field, dual, dim, dims, fuse, flip, isdual, insertunit +export space, field, dual, dim, dims, fuse, flip, isdual, insertunit, oplus # partial order for vector spaces export infimum, supremum, isisomorphic, ismonomorphic, isepimorphic # methods for sectors and properties thereof export sectortype, sectors, hassector, Nsymbol, Fsymbol, Rsymbol, Bsymbol, - frobeniusschur, twist + frobeniusschur, twist, otimes export fusiontrees, braid, permute, transpose export ZNSpace, SU2Irrep, U1Irrep, CU1Irrep # other fusion tree manipulations, should not be exported: diff --git a/src/sectors/sectors.jl b/src/sectors/sectors.jl index 132e728f..bfb83312 100644 --- a/src/sectors/sectors.jl +++ b/src/sectors/sectors.jl @@ -119,7 +119,8 @@ Base.isless(::Trivial, ::Trivial) = false # FusionStyle: the most important aspect of Sector #--------------------------------------------- """ - ⊗(a::I, b::I) where {I<:Sector} + ⊗(a::I, b::I...) where {I<:Sector} + otimes(a::I, b::I...) where {I<:Sector} Return an iterable of elements of `c::I` that appear in the fusion product `a ⊗ b`. @@ -128,6 +129,7 @@ Note that every element `c` should appear at most once, fusion degeneracies (if """ ⊗(::Trivial, ::Trivial) = (Trivial(),) ⊗(I::Sector) = (I,) +const otimes = ⊗ """ Nsymbol(a::I, b::I, c::I) where {I<:Sector} -> Integer diff --git a/src/spaces/vectorspaces.jl b/src/spaces/vectorspaces.jl index 0124868d..b2b7a454 100644 --- a/src/spaces/vectorspaces.jl +++ b/src/spaces/vectorspaces.jl @@ -123,6 +123,7 @@ Base.oneunit(V::ElementarySpace) = oneunit(typeof(V)) """ ⊕(V₁::S, V₂::S, V₃::S...) where {S<:ElementarySpace} -> S + oplus(V₁::S, V₂::S, V₃::S...) where {S<:ElementarySpace} -> S Return the corresponding vector space of type `S` that represents the direct sum sum of the spaces `V₁`, `V₂`, ... Note that all the individual spaces should have the same value for @@ -131,6 +132,7 @@ spaces `V₁`, `V₂`, ... Note that all the individual spaces should have the s function ⊕ end ⊕(V₁::VectorSpace, V₂::VectorSpace) = ⊕(promote(V₁, V₂)...) ⊕(V::Vararg{VectorSpace}) = foldl(⊕, V) +const oplus = ⊕ """ ⊗(V₁::S, V₂::S, V₃::S...) where {S<:ElementarySpace} -> S diff --git a/src/tensors/linalg.jl b/src/tensors/linalg.jl index 08b64454..4678b780 100644 --- a/src/tensors/linalg.jl +++ b/src/tensors/linalg.jl @@ -423,6 +423,7 @@ end # tensor product of tensors """ ⊗(t1::AbstractTensorMap{S}, t2::AbstractTensorMap{S}, ...) -> TensorMap{S} + otimes(t1::AbstractTensorMap{S}, t2::AbstractTensorMap{S}, ...) -> TensorMap{S} Compute the tensor product between two `AbstractTensorMap` instances, which results in a new `TensorMap` instance whose codomain is `codomain(t1) ⊗ codomain(t2)` and whose domain