Skip to content

Commit

Permalink
refined type aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Dec 22, 2024
1 parent cf497b7 commit 0495845
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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} = (ab,c...)

wedges(x,i=length(x)-1) = i 0 ? Expr(:call,:,wedges(x,i-1),x[1+i]) : x[1+i]
Expand Down
10 changes: 8 additions & 2 deletions src/multivectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

2 comments on commit 0495845

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/121830

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.27 -m "<description of version>" 049584579e8144d64e182fa2beee8a7639ae909b
git push origin v0.8.27

Please sign in to comment.