Skip to content

Commit

Permalink
exported some more basic syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Apr 25, 2024
1 parent 7a10932 commit 8ecd018
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/AbstractTensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,23 @@ Base.@pure mdims(M::T) where T<:TensorAlgebra = mdims(Manifold(M))
Base.@pure mdims(M::Type{T}) where T<:TensorAlgebra = mdims(Manifold(M))
Base.@pure mdims(M::Int) = M

"""
tdims(t::TensorAlgebra{V})

Dimensionality of the superalgebra of `V` for that `TensorAlgebra`.
"""
Base.@pure tdims(M::T) where T<:TensorAlgebra = 1<<mdims(M)
Base.@pure tdims(M::Type{T}) where T<:TensorAlgebra = 1<<mdims(M)
Base.@pure tdims(M::Int) = 1<<M

"""
gdims(t::TensorGraded{V,G})

Dimensionality of the grade `G` of `V` for that `TensorAlgebra`.
"""
Base.@pure gdims(t::TensorGraded{V,G}) where {V,G} = gdims(mdims(t),G)
Base.@pure gdims(N,G) = Base.binomial(N,G)

for (part,G) ∈ ((:scalar,0),(:vector,1),(:bivector,2),(:trivector,3))
ispart = Symbol(:is,part)
str = """
Expand All @@ -154,7 +171,7 @@ Return the pseudoscalar (full rank) part of any `TensorAlgebra` element.
"""
@inline pseudoscalar(t::T) where T<:Manifold = t
const volume = pseudoscalar
@inline volume(t::T) where T<:TensorGraded{V,G} where {V,G} = G == mdims(V) ? t : zero(V)
@inline volume(t::T) where T<:TensorGraded{V,G} where {V,G} = G == mdims(t) ? t : zero(V)
@inline isvolume(t::T) where T<:TensorGraded = rank(t) == mdims(t) || iszero(t)

"""
Expand Down Expand Up @@ -226,10 +243,10 @@ import AbstractLattices: ∧, ∨, wedge, vee

# extended compatibility interface

export TensorAlgebra, Manifold, TensorGraded, Distribution, expansion, metric, pseudometric
export Scalar, GradedVector, Bivector, Trivector, contraction, wedgedot, veedot, @pseudo
export istensor, ismanifold, isterm, isgraded, ismixed, rank, mdims, sandwich, antimetric
export scalar, isscalar, vector, isvector, bivector, isbivector, volume, isvolume,hodge
export TensorAlgebra, Manifold, TensorGraded, Scalar, GradedVector, Bivector, Trivector
export wedgedot, veedot, contraction, expansion, metric, pseudometric, antimetric, @pseudo
export istensor, ismanifold, isterm, isgraded, ismixed, rank, mdims, tdims, gdims, sandwich
export scalar, isscalar, vector, isvector, bivector, isbivector, volume, isvolume, hodge
export value, valuetype, interop, interform, involute, unit, unitize, unitnorm, even, odd
export ⟑, ⊘, ⊖, ⊗, ⊛, ⊙, ⊠, ×, ⨼, ⨽, ⋆, ∗, ⁻¹, ǂ, ₊, ₋, ˣ, antiabs, antiabs2, geomabs

Expand Down

2 comments on commit 8ecd018

@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/105630

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.1 -m "<description of version>" 8ecd0181099b59b13725f9c57d6067a3af61f22f
git push origin v0.8.1

Please sign in to comment.