From 049584579e8144d64e182fa2beee8a7639ae909b Mon Sep 17 00:00:00 2001 From: Michael Reed <18372368+chakravala@users.noreply.github.com> Date: Sat, 21 Dec 2024 21:02:28 -0500 Subject: [PATCH] refined type aliasing --- Project.toml | 2 +- src/algebra.jl | 1 + src/multivectors.jl | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 267e910..4e9c886 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Grassmann" uuid = "4df31cd9-4c27-5bea-88d0-e6a7146666d8" authors = ["Michael Reed"] -version = "0.8.26" +version = "0.8.27" [deps] AbstractTensors = "a8e43f4a-99b7-5565-8bf1-0165161caaea" diff --git a/src/algebra.jl b/src/algebra.jl index 8826e34..0e3afe6 100644 --- a/src/algebra.jl +++ b/src/algebra.jl @@ -113,6 +113,7 @@ Exterior product as defined by the anti-symmetric quotient Λ≡⊗/~ ∧(::Values{0,<:Chain{V}}) where V = One(V) # ∧() = 1 ∧(::FixedVector{0,<:Chain{V}}) where V = One(V) ∧(t::Chain{V,1,<:Chain} where V) = ∧(value(t)) +∧(t::Chain{V,1,<:Single} where V) = ∧(value(t)) ∧(a::X,b::Y,c::Z...) where {X<:TensorAlgebra,Y<:TensorAlgebra,Z<:TensorAlgebra} = ∧(a∧b,c...) wedges(x,i=length(x)-1) = i ≠ 0 ? Expr(:call,:∧,wedges(x,i-1),x[1+i]) : x[1+i] diff --git a/src/multivectors.jl b/src/multivectors.jl index c0c6ef0..639ebf1 100644 --- a/src/multivectors.jl +++ b/src/multivectors.jl @@ -82,8 +82,8 @@ Chain(v::Chain{V,G,𝕂}) where {V,G,𝕂} = v #Chain{𝕂}(v::Chain{V,G}) where {V,G,𝕂} = Chain{V,G}(Values{binomial(mdims(V),G),𝕂}(v.v)) @inline (::Type{T})(x...) where {T<:Chain} = T(x) -#Simplex{V,W,T<:GradedVector{W},N} = Chain{V,1,T,N} -Simplex{V,T<:GradedVector,N} = Chain{V,1,T,N} +#const Simplex{V,W,T<:GradedVector{W},N} = Chain{V,1,T,N} +const Simplex{V,T<:GradedVector,N} = Chain{V,1,T,N} getindex(m::Chain,i::Int) = m.v[i] getindex(m::Chain,i::UnitRange{Int}) = m.v[i] @@ -156,6 +156,9 @@ getindex(m::Chain{V,G,T},i::Submanifold{V}) where {V,G,T} = zero(T) function (m::Chain{V,G,T})(i::Integer) where {V,G,T} Single{V,G,DirectSum.getbasis(V,indexbasis(mdims(V),G)[i]),T}(m[i]) end +function (m::Chain{V,G,T})(::Val{i}) where {V,G,T,i} + Single{V,G,DirectSum.getbasis(V,indexbasis(mdims(V),G)[i]),T}(m[i]) +end @pure function Base.getproperty(a::Chain{V,G,T},v::Symbol) where {V,G,T} return if v == :v @@ -308,6 +311,9 @@ Multivector(val::NTuple{N,T}) where {N,T} = Multivector{log2sub(N)}(Values{N,T}( Multivector(val::NTuple{N,Any}) where N = Multivector{log2sub(N)}(Values{N}(val)) @inline (::Type{T})(x...) where {T<:Multivector} = T(x) +const Multiplex{V,T<:Multivector,N} = Multivector{V,T,N} +export Multiplex + function grade_src_chain(N,G,r=binomsum(N,G),is=isempty,T=Int) :(Chain{V,$G,T}($(grade_src(N,G,r,is,T)))) end