-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove no_generic_basering_coercion #29247
Comments
Commit: |
comment:2
A few remarks:
|
comment:3
Replying to @pjbruin:
This is done automatically by the coercion system when constructed via
It definitely should be a separate ticket that might need some design discussions.
I think the proper thing to do, which should be done on this ticket, is to promote it to the category of unital algebras and use the new mechanism here. |
comment:5
Replying to @tscrim:
Yes.
At first I thought this would be the wrong thing to do because the definition of algebras that I am used to implies that if A is an algebra over a ring R, then left multiplication and right multiplication by an element of R have the same effect. However, it seems this condition is not imposed by Sage, so giving an R-algebra is equivalent to giving a (unital, associative) ring A and a ring homomorphism from R to A. |
comment:6
Replying to @pjbruin:
My understanding is that for (magmatic) algebras, a left/right R-algebra has a left/right R-module structure, but nothing says that there has to be both or that these structures are the same. For unital algebras, the fact that LGTM. Thanks. |
Reviewer: Travis Scrimshaw |
comment:7
Merge conflict |
comment:8
Replying to @vbraun:
Any info as to what is the conflicting ticket? I just tried
and got no conflicts. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Changed branch from u/pbruin/29247-no_generic_basering_coercion to |
Changed commit from |
comment:12
It seems that this ticket does more than just deprecating
Defining I personally don't really care (external users of this kind of things probably have to adapt their code with every release anyway), but if it is easy to preserve compatibility with older versions, it may be a good think nevertheless. |
comment:13
Replying to @mezzarobba:
You are right, I accidentally deleted the |
comment:14
Another problem that seems to be caused by this ticket:
Presumably, this happens because the coercion from Python ints is a composite map via
but the coercion from
Do you have any ideas how to fix this? This came up in #25993. Another possible problem seems to be the following, but I am not sure whether letterplace algebras are missing
|
comment:15
I think the solution would be to define: def _coerce_map_from_base_ring(self):
return self._generic_coerce_map(self.base_ring()) which then redirects the What was happening before is in elif base_ring.has_coerce_map_from(other):
return True which ultimately just means the |
comment:16
Replying to @mwageringel:
I think the best way to fix this problem is to initialise --- a/src/sage/rings/polynomial/plural.pyx
+++ b/src/sage/rings/polynomial/plural.pyx
@@ -126,7 +126,7 @@ from sage.rings.finite_rings.finite_field_prime_modn import FiniteField_prime_mo
from sage.rings.integer cimport Integer
from sage.rings.integer_ring import is_IntegerRing
-from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular
+from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular, MPolynomial_libsingular, new_MP
from sage.rings.polynomial.multi_polynomial_ideal import NCPolynomialIdeal
from sage.rings.polynomial.polydict import ETuple
@@ -2860,13 +2860,16 @@ cpdef MPolynomialRing_libsingular new_CRing(RingWrap rw, base_ring):
sage: curcnt = ring_refcount_dict[currRing_wrapper()]
sage: newR = new_CRing(W, H.base_ring())
sage: ring_refcount_dict[currRing_wrapper()] - curcnt
- 1
+ 2
"""
assert( rw.is_commutative() )
cdef MPolynomialRing_libsingular self = <MPolynomialRing_libsingular>MPolynomialRing_libsingular.__new__(MPolynomialRing_libsingular)
self._ring = rw._ring
+ cdef MPolynomial_libsingular one = new_MP(self, p_ISet(1, self._ring))
+ self._one_element = one
+ self._one_element_poly = one._poly
wrapped_ring = wrap_ring(self._ring)
sage.libs.singular.ring.ring_refcount_dict[wrapped_ring] += 1 I compared this fix (which keeps the composite coercion map |
comment:17
Replying to @mwageringel:
Python classes inherit a --- a/src/sage/categories/unital_algebras.py
+++ b/src/sage/categories/unital_algebras.py
@@ -212,7 +212,8 @@ class UnitalAlgebras(CategoryWithAxiom_over_base_ring):
# If there is a specialised from_base_ring(), then it should
# be used unconditionally.
generic_from_base_ring = self.category().parent_class.from_base_ring
- if type(self).from_base_ring != generic_from_base_ring:
+ f = getattr(type(self), 'from_base_ring', None)
+ if f is not None and f != generic_from_base_ring:
# Custom from_base_ring()
use_from_base_ring = True
if isinstance(generic_from_base_ring, lazy_attribute): |
comment:18
The composite map is probably faster because |
comment:19
See #29311 and #29312 (the latter with a better solution than the one I suggested in comment:17). |
After #19225, the ad-hoc
no_generic_basering_coercion
attribute introduced in #11900 can be replaced by suitable_coerce_map_from_base_ring()
methods.CC: @tscrim
Component: coercion
Author: Peter Bruin
Branch:
db76cac
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/29247
The text was updated successfully, but these errors were encountered: