diff --git a/Project.toml b/Project.toml index 312ca75..1531a8d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Leibniz" uuid = "edad4870-8a01-11e9-2d75-8f02e448fc59" authors = ["Michael Reed"] -version = "0.0.1" +version = "0.0.2" [deps] AbstractTensors = "a8e43f4a-99b7-5565-8bf1-0165161caaea" @@ -12,9 +12,11 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] julia = "1" +DirectSum = "0.3" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +Grassmann = "4df31cd9-4c27-5bea-88d0-e6a7146666d8" [targets] -test = ["Test"] +test = ["Test","Grassmann"] diff --git a/src/Leibniz.jl b/src/Leibniz.jl index 43b4033..bd1c34a 100644 --- a/src/Leibniz.jl +++ b/src/Leibniz.jl @@ -6,7 +6,7 @@ module Leibniz using DirectSum, StaticArrays #, Requires using LinearAlgebra, AbstractTensors, AbstractLattices import Base: *, ^, +, -, /, show, zero -import DirectSum: value, V0, dualtype, pre +import DirectSum: value, V0, mixedmode, pre export Differential, Monomial, Derivation, d, ∂, ∇, Δ, @operator @@ -32,8 +32,8 @@ value(d::Monomial{V,G,D,T} where {V,G,D}) where T = d.v sups(O) = O ≠ 1 ? DirectSum.sups[O] : "" -show(io::IO,d::Monomial{V,G,D,O,Bool} where G) where {V,D,O} = print(io,value(d) ? "" : "-",pre[dualtype(V)>0 ? 4 : 3],[DirectSum.subs[k] for k ∈ DirectSum.shift_indices(V,UInt(D))]...,sups(O)) -show(io::IO,d::Monomial{V,G,D,O} where G) where {V,D,O} = print(io,value(d),pre[dualtype(V)>0 ? 4 : 3],[DirectSum.subs[k] for k ∈ DirectSum.shift_indices(V,UInt(D))]...,sups(O)) +show(io::IO,d::Monomial{V,G,D,O,Bool} where G) where {V,D,O} = print(io,value(d) ? "" : "-",pre[mixedmode(V)>0 ? 4 : 3],[DirectSum.subs[k] for k ∈ DirectSum.shift_indices(V,UInt(D))]...,sups(O)) +show(io::IO,d::Monomial{V,G,D,O} where G) where {V,D,O} = print(io,value(d),pre[mixedmode(V)>0 ? 4 : 3],[DirectSum.subs[k] for k ∈ DirectSum.shift_indices(V,UInt(D))]...,sups(O)) show(io::IO,d::Monomial{V,G,D,0,Bool} where {V,G,D}) = print(io,value(d) ? 1 : -1) show(io::IO,d::Monomial{V,G,0,O,Bool} where {V,G,O}) = print(io,value(d) ? 1 : -1) show(io::IO,d::Monomial{V,0,D,O,Bool} where {V,D,O}) = print(io,value(d) ? 1 : -1) @@ -50,7 +50,7 @@ show(io::IO,d::Monomial{V,UInt(0)} where V) = print(io,value(d)) indexint(D) = DirectSum.bit2int(DirectSum.indexbits(max(D...),D)) ∂(D::T...) where T<:Integer = Monomial{V0,length(D),indexint(D)}() -∂(V::S,D::T...) where {S<:VectorSpace,T<:Integer} = Monomial{V,length(D),indexint(D)}() +∂(V::S,D::T...) where {S<:VectorBundle,T<:Integer} = Monomial{V,length(D),indexint(D)}() *(r,d::Monomial) = d*r *(d::Monomial{V,G,D,0} where {V,G,D},r) = r