Skip to content

Commit

Permalink
Optimize summation convention for terms
Browse files Browse the repository at this point in the history
  • Loading branch information
tschijnmo committed Apr 4, 2017
1 parent a63ed7f commit a690cf0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drudge/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,9 @@ def replace_cb(_, *curr_indices):
new_sums = []
for symb, use in use_tally.items():

if symb in existing_dumms:
continue

if use[0] != 2 and use[0] + use[1] != 2:
# No chance to be an Einstein summation.
continue
Expand All @@ -1484,8 +1487,7 @@ def replace_cb(_, *curr_indices):
continue

# Now we have an Einstein summation.
if symb not in existing_dumms:
new_sums.append((symb, range_))
new_sums.append((symb, range_))
continue

# Make summation from Einstein convention deterministic.
Expand Down

0 comments on commit a690cf0

Please sign in to comment.