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

Commit

Permalink
automatically determine SchemeMorphism base ring if none is given
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyx4 committed Aug 13, 2022
1 parent 658c959 commit 6dc2131
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/sage/schemes/generic/homset.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ class SchemeHomsetFactory(UniqueFactory):
TESTS::
sage: Hom.base()
Integer Ring
Rational Field
sage: Hom.base_ring()
Integer Ring
Rational Field
"""

def create_key_and_extra_args(self, X, Y, category=None, base=ZZ,
def create_key_and_extra_args(self, X, Y, category=None, base=None,
check=True, as_point_homset=False):
"""
Create a key that uniquely determines the Hom-set.
Expand Down Expand Up @@ -142,17 +142,20 @@ def create_key_and_extra_args(self, X, Y, category=None, base=ZZ,
sage: SHOMfactory = SchemeHomsetFactory('test')
sage: key, extra = SHOMfactory.create_key_and_extra_args(A3,A2,check=False)
sage: key
(..., ..., Category of schemes over Integer Ring, False)
(..., ..., Category of schemes over Rational Field, False)
sage: extra
{'X': Affine Space of dimension 3 over Rational Field,
'Y': Affine Space of dimension 2 over Rational Field,
'base_ring': Integer Ring,
'base_ring': Rational Field,
'check': False}
"""
if isinstance(X, CommutativeRing):
X = AffineScheme(X)
if isinstance(Y, CommutativeRing):
Y = AffineScheme(Y)
if base is None:
from sage.structure.all import coercion_model
base = coercion_model.common_parent(X.base_ring(), Y.base_ring())
if is_AffineScheme(base):
base_spec = base
base_ring = base.coordinate_ring()
Expand Down

0 comments on commit 6dc2131

Please sign in to comment.