Skip to content

Commit

Permalink
Update tensors.py
Browse files Browse the repository at this point in the history
never used isort or black before :(
Hope it passes the checks this time.
  • Loading branch information
Li-Xiang-Ideal authored Nov 16, 2023
1 parent f779a44 commit 3500cab
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions mathics/builtin/tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@ def eval(self, d, type, evaluation: Evaluation):
if isinstance(d, Integer) and type == SymbolSparseArray:
d = d.get_int_value()
perms = list(permutations([i for i in range(1, d + 1)]))
rules = [Expression(SymbolRule, from_python(p), from_python(Permutation.from_sequence(p).signature())) for p in perms]
return Expression(SymbolSparseArray, from_python(rules), from_python([d] * d))

rules = [
Expression(
SymbolRule,
from_python(p),
from_python(Permutation.from_sequence(p).signature()),
)
for p in perms
]
return Expression(
SymbolSparseArray, from_python(rules), from_python([d] * d)
)

0 comments on commit 3500cab

Please sign in to comment.