@@ -8,6 +8,12 @@ export valuetype, value, hasinf, hasorigin, isorigin, norm, indices, tangent, is
88(M:: Signature )(b:: Int... ) = SubManifold{M}(b)
99(M:: DiagonalForm )(b:: Int... ) = SubManifold{M}(b)
1010(M:: SubManifold )(b:: Int... ) = SubManifold{supermanifold(M)}(b)
11+ (M:: Signature )(b:: T ) where T<: AbstractVector{Int} = SubManifold{M}(b)
12+ (M:: DiagonalForm )(b:: T ) where T<: AbstractVector{Int} = SubManifold{M}(b)
13+ (M:: SubManifold )(b:: T ) where T<: AbstractVector{Int} = SubManifold{supermanifold(M)}(b)
14+ (M:: Signature )(b:: T ) where T<: AbstractRange{Int} = SubManifold{M}(b)
15+ (M:: DiagonalForm )(b:: T ) where T<: AbstractRange{Int} = SubManifold{M}(b)
16+ (M:: SubManifold )(b:: T ) where T<: AbstractRange{Int} = SubManifold{supermanifold(M)}(b)
1117
1218@pure Base. ndims(S:: SubManifold{M,G} ) where {G,M} = isbasis(S) ? ndims(M) : G
1319@pure grade(V:: M ) where M<: Manifold{N} where N = N- (isdyadic(V) ? 2 : 1 )* diffvars(V)
@@ -50,15 +56,21 @@ const mixedmode = dyadmode
5056@inline value(:: SubManifold ,T= Int) = T== Any ? 1 : one(T)
5157@inline value(m:: Simplex ,T:: DataType = valuetype(m)) = T∉ (valuetype(m),Any) ? convert(T,m. v) : m. v
5258@inline value_diff(m:: T ) where T<: TensorTerm = (v= value(m);istensor(v) ? v : m)
53- @pure isbasis(:: SubManifold{V} ) where V = typeof(V)<: SubManifold
54- @pure isbasis(:: T ) where T<: TensorBundle = false
55- @pure isbasis(:: Simplex ) = false
59+
60+ for T ∈ (:T,:(Type{T}))
61+ @eval begin
62+ @pure isbasis(:: $T ) where T<: SubManifold{V} where V = typeof(V)<: SubManifold
63+ @pure isbasis(:: $T ) where T<: TensorAlgebra = false
64+ @pure isbasis(:: $T ) where T<: TensorBundle = false
65+ @pure isbasis(:: $T ) where T<: Simplex = false
66+ @pure bits(b:: $T ) where T<: SubManifold{V,G,B} where {V,G} where B = B:: UInt
67+ @pure UInt(b:: $T ) where T<: SubManifold{V,G,B} where {V,G} where B = B:: UInt
68+ end
69+ end
70+ @pure UInt(m:: T ) where T<: TensorTerm = UInt(basis(m))
71+ @pure bits(m:: T ) where T<: TensorTerm = bits(basis(m))
5672@pure basis(m:: SubManifold ) = isbasis(m) ? m : SubManifold(m)
5773@pure basis(m:: Simplex{V,G,B} where {V,G}) where B = B
58- @pure UInt(m:: T ) where T<: TensorTerm = bits(basis(m))
59- @pure bits(m:: T ) where T<: TensorTerm = bits(basis(m))
60- @pure bits(b:: SubManifold{V,G,B} where {V,G}) where B = B:: UInt
61- @pure bits(:: Type{SubManifold{V,G,B}} where {V,G}) where B = B
6274@pure det(s:: Signature ) = isodd(count_ones(metric(s))) ? - 1 : 1
6375@pure det(s:: DiagonalForm ) = PROD(diagonalform(s))
6476@pure Base. abs(s:: SubManifold ) = isbasis(s) ? Base. sqrt(Base. abs2(s)) : sqrt(abs(det(s)))
0 commit comments