Skip to content

Commit f3c6b0d

Browse files
committed
small changes
1 parent 9a6e65c commit f3c6b0d

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/sage/modular/modform/element.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,6 +3234,14 @@ def __init__(self, parent, forms_datum):
32343234
Traceback (most recent call last):
32353235
...
32363236
ValueError: the group and/or the base ring of at least one modular form (q - 6*q^2 + 9*q^3 + 4*q^4 + 6*q^5 + O(q^6)) is not consistant with the base space
3237+
sage: M = ModularFormsRing(Gamma0(2))
3238+
sage: E4 = ModularForms(1, 4).0
3239+
sage: M(E4)[4].parent()
3240+
Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(2) of weight 4 over Rational Field
3241+
sage: M = ModularFormsRing(Gamma1(3), base_ring=GF(7))
3242+
sage: E6 = ModularForms(1, 6, base_ring=GF(7)).0
3243+
sage: M(E6)[6].parent()
3244+
Modular Forms space of dimension 3 for Congruence Subgroup Gamma1(3) of weight 6 over Finite Field of size 7
32373245
"""
32383246
forms_dictionary = {}
32393247
if isinstance(forms_datum, dict):
@@ -3245,7 +3253,8 @@ def __init__(self, parent, forms_datum):
32453253
elif is_ModularFormElement(f):
32463254
if f.weight() == k:
32473255
if parent.group().is_subgroup(f.group()) and parent.base_ring().has_coerce_map_from(f.base_ring()):
3248-
forms_dictionary[k] = f
3256+
M = parent.modular_forms_of_weight(f.weight()).change_ring(parent.base_ring())
3257+
forms_dictionary[k] = M(f)
32493258
else:
32503259
raise ValueError('the group and/or the base ring of at least one modular form (%s) is not consistant with the base space' % (f))
32513260
else:
@@ -3261,7 +3270,8 @@ def __init__(self, parent, forms_datum):
32613270
if (chi is not None) and (not chi.is_trivial()):
32623271
raise NotImplementedError("graded modular forms for non-trivial characters is not yet implemented")
32633272
if parent.group().is_subgroup(f.group()) and parent.base_ring().has_coerce_map_from(f.base_ring()):
3264-
forms_dictionary[f.weight()] = forms_dictionary.get(f.weight(), 0) + f
3273+
M = parent.modular_forms_of_weight(f.weight()).change_ring(parent.base_ring())
3274+
forms_dictionary[f.weight()] = M(forms_dictionary.get(f.weight(), 0) + f)
32653275
else:
32663276
raise ValueError('the group and/or the base ring of at least one modular form (%s) is not consistant with the base space' % (f))
32673277
else:

src/sage/modular/modform/ring.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,19 +511,14 @@ def _element_constructor_(self, forms_datum):
511511
Traceback (most recent call last):
512512
...
513513
NotImplementedError: conversion from q-expansion not yet implemented
514-
sage: M = ModularFormsRing(Gamma0(2))
515-
sage: E4 = ModularForms(1, 4).0
516-
sage: M(E4)[4].parent()
517-
Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(2) of weight 4 over Rational Field
518514
"""
519515
if isinstance(forms_datum, (dict, list)):
520516
forms_dictionary = forms_datum
521517
elif isinstance(forms_datum, self.element_class):
522518
forms_dictionary = forms_datum._forms_dictionary
523519
elif is_ModularFormElement(forms_datum):
524520
if self.group().is_subgroup(forms_datum.group()) and self.base_ring().has_coerce_map_from(forms_datum.base_ring()):
525-
M = ModularForms(self.group(), forms_datum.weight(), self.base_ring())
526-
forms_dictionary = {forms_datum.weight() : M(forms_datum)}
521+
forms_dictionary = {forms_datum.weight() : forms_datum}
527522
else:
528523
raise ValueError('the group (%s) and/or the base ring (%s) of the given modular form is not consistant with the base space: %s'%(forms_datum.group(), forms_datum.base_ring(), self))
529524
elif forms_datum in self.base_ring():

0 commit comments

Comments
 (0)