Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/tensor, src/sage/manifolds: Remove parameter 'trivial_symmet…
Browse files Browse the repository at this point in the history
…ries' again
  • Loading branch information
Matthias Koeppe committed Sep 1, 2022
1 parent e34306b commit c6b6b2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 32 deletions.
6 changes: 2 additions & 4 deletions src/sage/manifolds/differentiable/vectorfield_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,7 @@ def tensor(self, tensor_type, name=None, latex_name=None, sym=None,
DegenerateMetric)
from sage.tensor.modules.comp import CompWithSym
sym, antisym = CompWithSym._canonicalize_sym_antisym(
tensor_type[0] + tensor_type[1], sym, antisym,
trivial_symmetries='error')
tensor_type[0] + tensor_type[1], sym, antisym)
if tensor_type == (1,0):
return self.element_class(self, name=name,
latex_name=latex_name)
Expand Down Expand Up @@ -2077,8 +2076,7 @@ def tensor(self, tensor_type, name=None, latex_name=None, sym=None,
DegenerateMetric)
from sage.tensor.modules.comp import CompWithSym
sym, antisym = CompWithSym._canonicalize_sym_antisym(
tensor_type[0] + tensor_type[1], sym, antisym,
trivial_symmetries='error')
tensor_type[0] + tensor_type[1], sym, antisym)
if tensor_type == (1,0):
return self.element_class(self, name=name,
latex_name=latex_name)
Expand Down
23 changes: 3 additions & 20 deletions src/sage/tensor/modules/comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2982,25 +2982,9 @@ class CompWithSym(Components):
)
sage: e + d == d + e
True
TESTS:
Errors are raised if trivial symmetries appear in the list of symmetries or
antisymmetries::
sage: CompWithSym(QQ, V.basis(), 3, sym=[[1]])
Traceback (most recent call last):
...
IndexError: at least two index positions must be provided to define a symmetry
sage: CompWithSym(QQ, V.basis(), 2, antisym=[[]])
Traceback (most recent call last):
...
IndexError: at least two index positions must be provided to define an antisymmetry
"""
def __init__(self, ring, frame, nb_indices, start_index=0,
output_formatter=None, sym=None, antisym=None,
trivial_symmetries='error'):
output_formatter=None, sym=None, antisym=None):
r"""
TESTS::
Expand All @@ -3012,11 +2996,10 @@ def __init__(self, ring, frame, nb_indices, start_index=0,
Components.__init__(self, ring, frame, nb_indices, start_index,
output_formatter)
self._sym, self._antisym = self._canonicalize_sym_antisym(
nb_indices, sym, antisym, trivial_symmetries=trivial_symmetries)
nb_indices, sym, antisym)

@staticmethod
def _canonicalize_sym_antisym(nb_indices, sym=None, antisym=None, *,
trivial_symmetries='drop'):
def _canonicalize_sym_antisym(nb_indices, sym=None, antisym=None):
r"""
Bring sym and antisym into their canonical form.
Expand Down
12 changes: 4 additions & 8 deletions src/sage/tensor/modules/finite_rank_free_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1654,18 +1654,14 @@ def tensor(self, tensor_type, name=None, latex_name=None, sym=None,
TESTS:
Errors are raised if trivial symmetries appear in the list of symmetries or
antisymmetries::
Trivial symmetries in the list of symmetries or antisymmetries are silently
ignored::
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: M.tensor((3,0), sym=[[1]])
Traceback (most recent call last):
...
IndexError: at least two index positions must be provided to define a symmetry
Type-(3,0) tensor on the Rank-3 free module M over the Integer Ring
sage: M.tensor((3,0), antisym=[[]])
Traceback (most recent call last):
...
IndexError: at least two index positions must be provided to define an antisymmetry
Type-(3,0) tensor on the Rank-3 free module M over the Integer Ring
"""
from .comp import CompWithSym
sym, antisym = CompWithSym._canonicalize_sym_antisym(
Expand Down

0 comments on commit c6b6b2e

Please sign in to comment.