Skip to content

Commit

Permalink
Fix canonicalising of expressions containing self-anticommuting objec…
Browse files Browse the repository at this point in the history
…ts and derivatives.
  • Loading branch information
Kasper Peeters committed Nov 22, 2023
1 parent cf053c1 commit 6803381
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/properties/Derivative.hh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "properties/DependsInherit.hh"
#include "properties/IndexInherit.hh"
#include "properties/SortOrder.hh"
#include "properties/SelfCommutingBehaviour.hh"

namespace cadabra {

Expand All @@ -17,6 +18,7 @@ namespace cadabra {
public TableauInherit,
public DependsInherit,
public Inherit<SortOrder>,
public Inherit<SelfCommutingBehaviour>,
public CommutingAsProduct,
public NumericalFlat,
public WeightBase,
Expand Down
25 changes: 25 additions & 0 deletions tests/canonicalise.cdb
Original file line number Diff line number Diff line change
Expand Up @@ -881,3 +881,28 @@ def test59():
print("Test 59b passed")

test59()

def test60():
# Anti-commuting objects in canonicalise did not
# pass their info through derivatives.
# Issue #113.
__cdbkernel__=create_scope()

{a, b, c}::Indices(Vector, position=independent);
X_{a}::SelfAntiCommuting ;
\partial{#}::Derivative;
X_{a}::Depends(\partial{#});

foo1 := \partial{X_{b}} \partial{X_{a}} + X_{b} X_{a};
canonicalise(foo1)
tst := -\partial{X_{a}} \partial{X_{b}} - X_{a} X_{b} - @(foo1);
assert(tst==0)
print("Test 60a passed")

foo2 := \partial{X_{b}} \partial{X_{a}} + X_{b} X_{a};
sort_product(foo2)
tst := -\partial{X_{a}} \partial{X_{b}} - X_{a} X_{b} - @(foo2);
assert(tst==0)
print("Test 60b passed")

test60()

0 comments on commit 6803381

Please sign in to comment.