Skip to content

Commit

Permalink
Fix canonicalise not working correctly on objects with Accents.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasper Peeters committed Dec 15, 2023
1 parent 03d87e5 commit e2b7489
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/algorithms/canonicalise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ Algorithm::result_t canonicalise::apply(iterator& it)
// std::cerr << Ex(facit) << " has tableaubase " << tba << std::endl;
if(tba) {
unsigned int num_ind=number_of_indices(facit);
#ifdef XPERM_DEBUG
std::cerr << "factor " << *facit->name << " has " << num_ind << " indices" << std::endl;
#endif

// Add indices to the base. We used to add everything except the last one, but that
// seems to be the wrong thing to do after the XPERM -> XPERM_EXT upgrade (see Jose's email).
Expand Down
2 changes: 1 addition & 1 deletion core/properties/AntiSymmetric.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TableauBase::tab_t AntiSymmetric::get_tab(const Properties& pr, Ex& tr, Ex::iter
}

tab_t tab;
for(unsigned int i=0; i<Ex::number_of_children(it); ++i)
for(unsigned int i=0; i<Algorithm::number_of_indices(pr, it); ++i)
tab.add_box(i,i);
return tab;
}
Expand Down
3 changes: 2 additions & 1 deletion core/properties/Symmetric.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include "Algorithm.hh"
#include "properties/Symmetric.hh"

using namespace cadabra;
Expand Down Expand Up @@ -26,7 +27,7 @@ TableauBase::tab_t Symmetric::get_tab(const Properties& pr, Ex& tr, Ex::iterator
}

tab_t tab;
for(unsigned int i=0; i<tr.number_of_children(it); ++i)
for(unsigned int i=0; i<Algorithm::number_of_indices(pr, it); ++i)
tab.add_box(0,i);
return tab;
}
Expand Down
13 changes: 13 additions & 0 deletions tests/canonicalise.cdb
Original file line number Diff line number Diff line change
Expand Up @@ -906,3 +906,16 @@ def test60():
print("Test 60b passed")

test60()

def test61():
{a,b,c,d#}::Indices(position=independent).
\bar{#}::Accent.
\bar{A}_{a b}::Symmetric.
\bar{A}^{a b}::Symmetric.
ex := \bar{A}_{a b} \bar{A}^{b a};
canonicalise (ex);
tst:= \bar{A}_{a b} \bar{A}^{a b} - @(ex);
assert(tst==0)
print("Test 61 passed")

test61()

0 comments on commit e2b7489

Please sign in to comment.