Skip to content

Commit

Permalink
generalized to higher order derivations
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Oct 5, 2019
1 parent 5a6e9e5 commit 1f1f5b1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
35 changes: 23 additions & 12 deletions src/algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ symmetricsplit(V::M,b::Basis) where M<:Manifold = symmetricsplit(V,bits(b))
else
sa,sb = symmetricsplit(V,A),symmetricsplit(V,B)
ca,cb = count_ones(sa[2]),count_ones(sb[2])
return if ca == cb == 0
return if (ca == cb == 0) || ((ca 0) && (cb 0))
v
elseif ca == 0
derive(x ? one(typeof(v)) : v,getbasis(V,sa[1]))
elseif cb == 0
derive(x ? v : one(typeof(v)),getbasis(V,sb[1]))
else
v
prev = ca == 0 ? (x ? one(typeof(v)) : v) : (x ? v : one(typeof(v)))
for k DirectSum.indexsplit((ca==0 ? sa : sb)[1],ndims(V))
prev = derive(prev,getbasis(V,k))
end
prev
end
end
end
Expand All @@ -56,14 +56,25 @@ end
else
sa,sb = symmetricsplit(V,A),symmetricsplit(V,B)
ca,cb = count_ones(sa[2]),count_ones(sb[2])
α,β = if ca == cb == 0
α,β = if (ca == cb == 0) || ((ca 0) && (cb 0))
a,b
elseif ca == 0
derive(b,getbasis(V,sa[1]),a,true)
elseif cb == 0
derive(a,getbasis(V,sb[1]),b,false)
else
a,b
prev = ca == 0 ? (a,b) : (b,a)
for k DirectSum.indexsplit((ca==0 ? sa : sb)[1],ndims(V))
prev = derive(prev[2],getbasis(V,k),prev[1],true)
end
#base = getbasis(V,0)
while typeof(prev[1]) <: TensorTerm
basi = basis(prev[1])
#base *= basi
inds = DirectSum.indexsplit(bits(basi),ndims(V))
prev = (value(prev[1]),prev[2])
for k inds
prev = derive(prev[2],getbasis(V,k),prev[1],true)
end
end
#base ≠ getbasis(V,0) && (prev = (base*prev[1],prev[2]))
ca == 0 ? prev : (prev[2],prev[1])
end
return α*β
end
Expand Down
6 changes: 6 additions & 0 deletions src/multivectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,12 @@ end
@inline isscalar(t::MultiVector) = norm(t) scalar(t)
@inline isscalar(t::MultiGrade) = norm(t) scalar(t)

for Blade MSB
for T (Expr,Symbol)
@eval @inline Base.iszero(t::$Blade{V,G,B,$T} where {V,G,B}) = false
end
end

## Adjoint

import Base: adjoint # conj
Expand Down

3 comments on commit 1f1f5b1

@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 updated: JuliaRegistries/General/4124

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 Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" 1f1f5b1403c9fc3d13ca04ebcebb42688104005a
git push origin v0.3.1

@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.

this commit is a step towards #33

Please sign in to comment.