Skip to content

Commit

Permalink
documented some boolean tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Oct 2, 2024
1 parent ee590f5 commit c52a0ca
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AbstractTensors"
uuid = "a8e43f4a-99b7-5565-8bf1-0165161caaea"
authors = ["Michael Reed"]
version = "0.8.5"
version = "0.8.6"

[deps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
32 changes: 31 additions & 1 deletion src/AbstractTensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ Universal root tensor type with `Manifold` instance `V` with scalar field `T`.
abstract type TensorAlgebra{V,T} <: Number end
TensorAlgebra{V}(t::TensorAlgebra{V}) where V = t
TensorAlgebra{V}(t::TensorAlgebra{W}) where {V,W} = (VW)(t)

"""
istensor(t) -> Bool
Test whether `t` is some subtype of `TensorAlgebra`.
"""
Base.@pure istensor(t::T) where T<:TensorAlgebra = true
Base.@pure istensor(t) = false

Expand All @@ -41,6 +47,12 @@ Base.@pure istensor(t) = false
Basis parametrization locally homeomorphic to `T^n` product topology.
"""
abstract type Manifold{V,T} <: TensorAlgebra{V,T} end

"""
ismanifold(t) -> Bool
Test whether `t` is some subtype of `Manifold`.
"""
Base.@pure ismanifold(t::T) where T<:Manifold = true
Base.@pure ismanifold(t) = false

Expand All @@ -51,6 +63,12 @@ Grade `G` elements of a `Manifold` instance `V` with scalar field `T`.
"""
abstract type TensorGraded{V,G,T} <: Manifold{V,T} end
const TAG = (:TensorAlgebra,:TensorGraded)

"""
isgraded(t) -> Bool
Test whether `t` is some subtype of `TensorGraded`.
"""
Base.@pure isgraded(t::T) where T<:TensorGraded = true
Base.@pure isgraded(t) = false

Expand Down Expand Up @@ -88,6 +106,12 @@ const Trivector{V,T} = TensorGraded{V,3,T}
Single coefficient for grade `G` of a `Manifold` instance `V` with scalar field `T`.
"""
abstract type TensorTerm{V,G,T} <: TensorGraded{V,G,T} end

"""
isterm(t) -> Bool
Test whether `t` is some subtype of `TensorTerm`.
"""
Base.@pure isterm(t::T) where T<:TensorTerm = true
Base.@pure isterm(t) = false
Base.isfinite(b::T) where T<:TensorTerm = isfinite(value(b))
Expand All @@ -98,6 +122,12 @@ Base.isfinite(b::T) where T<:TensorTerm = isfinite(value(b))
Elements of `Manifold` instance `V` having non-homogenous grade with scalar field `T`.
"""
abstract type TensorMixed{V,T} <: TensorAlgebra{V,T} end

"""
ismixed(t) -> Bool
Test whether `t` is some subtype of `TensorMixed`.
"""
Base.@pure ismixed(t::T) where T<:TensorMixed = true
Base.@pure ismixed(t) = false

Expand Down Expand Up @@ -559,7 +589,7 @@ const RealArray{N,T<:Real} = AbstractArray{T,N}

export TupleVector, Values, Variables, FixedVector

import StaticVectors: Values, Variables, FixedVector, TupleVector, _diff
import StaticVectors: Values, Variables, FixedVector, TupleVector, evens, _diff
import StaticVectors: SVector, MVector, SizedVector, countvalues, evenvalues

end # module

2 comments on commit c52a0ca

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

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.6 -m "<description of version>" c52a0ca71728298a7cff2e58531ba9c4620d7115
git push origin v0.8.6

Please sign in to comment.