Skip to content

Commit

Permalink
generalized (anti)-symmetrization formula
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Jun 14, 2019
1 parent 959957d commit 10283a5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,19 @@ function cross(a::X,b::Y) where {X<:TensorTerm{V},Y<:TensorTerm{V}} where V
return SValue{V}(p ? -v : v,Basis{V}(C))
end

## commutator product
# symmetrization and anti-symmetrization

export
export ,

(a,b) = a*b - b*a
(x::T...) where T<:TensorAlgebra{V} where V = sum(x)/factorial(length(x))

function (x::T...) where T<:TensorAlgebra{V} where V
K,P,out = length(x),collect(permutations(1:K)),x[1]
for n 2:K
DirectSum.indexparity!(P,V)[1] ? (out-=x[n]) : (out+=x[n])
end
return out/factorial(K)
end

### Product Algebra Constructor

Expand Down

0 comments on commit 10283a5

Please sign in to comment.