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

Commit

Permalink
Use basis._symbol as prefix only when it is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jul 21, 2020
1 parent 40f589f commit affd0c9
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/sage/tensor/modules/finite_rank_free_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2555,6 +2555,15 @@ def isomorphism_with_fixed_basis(self, basis, codomain=None):
sage: phi_e(e[1] + 2 * e[2])
e[1] + 2*e[2]
sage: abc = V.basis(['a', 'b', 'c'], symbol_dual=['d', 'e', 'f']); abc
Basis (a,b,c) on the 3-dimensional vector space over the Rational Field
sage: phi_abc = V.isomorphism_with_fixed_basis(abc); phi_abc
Generic morphism:
From: 3-dimensional vector space over the Rational Field
To: Free module generated by {1, 2, 3} over Rational Field
sage: phi_abc(abc[1] + 2 * abc[2])
B[1] + 2*B[2]
Providing a codomain::
sage: W = CombinatorialFreeModule(QQ, ['a', 'b', 'c'])
Expand All @@ -2578,14 +2587,16 @@ def isomorphism_with_fixed_basis(self, basis, codomain=None):
Traceback (most recent call last):
...
ValueError: domain and codomain must have the same base ring
"""
base_ring = self.base_ring()
if codomain is None:
from sage.combinat.free_module import CombinatorialFreeModule

if isinstance(basis._symbol, str):
prefix = basis._symbol
else:
prefix = None
codomain = CombinatorialFreeModule(base_ring, list(self.irange()),
prefix=basis._symbol)
prefix=prefix)
else:
if codomain.rank() != self.rank():
raise ValueError("domain and codomain must have the same rank")
Expand Down

0 comments on commit affd0c9

Please sign in to comment.