Re: [sage-devel] Possible bug: specifying category messes up coercion?
It is trying to do coercion, as it rightly should IMO. Since you have specified that it is an algebra, it should have the base ring coercion, which means that the "algebra" knows what 1 is. An algebra should not be testing that it knows what 1 is because it is an assumption of being in that category. I don't think we should make other code more complicated and potentially slower to have a "better" failure on a malformed object. Best, Travis On Friday, February 4, 2022 at 9:27:10 AM UTC+9 Akos M wrote: > I agree, any reference to 1 should fail. > But does the zero element of an algebra (i.e. its neutral element as a > Z-module) really have to refer to the identity element of the algebra? > Also, it probably should throw an error, instead of getting stuck in an > infinite loop. > > Best, > Akos > On Friday, February 4, 2022 at 1:17:33 AM UTC+1 Travis Scrimshaw wrote: > >> As I stated on the ticket, this is not a bug because you have not >> properly defined your algebra. It needs to have an (multiplicative) >> identity specified as it is rightfully expecting it. This is the correct >> behavior because you are saying it is an algebra without specifying what >> the algebra structure is. In particular, you need to specify what one() is. >> >> Best, >> Travis >> >> On Friday, February 4, 2022 at 7:49:19 AM UTC+9 vdelecroix wrote: >> >>> There is an explanation and a "solution" on the ticket. >>> >>> Best >>> Vincent >>> >>> Le 03/02/2022 à 23:48, Akos M a écrit : >>> > Replacing 0 with self.zero() works perfectly, thank you! >>> > >>> > Best, >>> > Akos >>> > >>> > On Thursday, February 3, 2022 at 11:34:43 PM UTC+1 Akos M wrote: >>> > >>> >> Thanks for the feedback. >>> >> >>> >> Indeed, defined as such, C is a broken object - this was just the >>> smallest >>> >> example where I could reproduce the error. >>> >> >>> >> I was hoping that it should be possible to access the module elements >>> >> without referring to 1, or multiplication. >>> >> I would like to define multiplication later in the definition of some >>> >> algebraic structure, but still inherit the methods from the category. >>> >> (Similarly to >>> >> >>> https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html >>> >>> >> ) >>> >> >>> >> In particular, the error originally appeared in the form of >>> >> "if x == 0:" >>> >> where x is an element of the module, as should be 0 (now coerced..). >>> >> >>> >> Best, >>> >> Akos >>> >> On Thursday, February 3, 2022 at 10:10:29 PM UTC+1 vdelecroix wrote: >>> >> >>> >>> Now I am thinking about it, I am not sure it is a bug. You did >>> >>> not defined any algebra structure (neither the unit nor the >>> >>> product on the basis). C is definitely a broken object. >>> >>> >>> >>> However, it would make sense for C(0) not to call C(1). >>> >>> >>> >>> Vincent >>> >>> >>> >>> Le 03/02/2022 à 21:49, Akos M a écrit : >>> Thanks, I created - my first - ticket. >>> https://trac.sagemath.org/ticket/33285#ticket >>> >>> Once the ticket is (eventually) resolved, how do I update sage to >>> >>> involve >>> the resolution? >>> >>> Thanks, >>> Akos >>> >>> On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: >>> >>> > It is definitely a bug. Do you know how to open >>> > a ticket on the trac server ? >>> > >>> > The infinite loop comes from C.one() calling C(1) >>> > calling C.one()... When you specify a category >>> > the inheritance is different and this explains >>> > the difference of behaviour. >>> > >>> > Best >>> > Vincent >>> > >>> > Le 03/02/2022 à 11:29, Akos M a écrit : >>> >> >>> >> >>> >> Hi, >>> >> >>> >> The snippet >>> >> D = CombinatorialFreeModule(ZZ, [1,2]) D(0) >>> >> >>> >> works fine, however >>> >> C = CombinatorialFreeModule(ZZ, [1,2], >>> >>> category=AlgebrasWithBasis(ZZ)) >>> > C(0) >>> >> >>> >> gets into an infinite loop: >>> >> File >>> >> >>> > >>> >>> >>> "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", >>> >>> >>> >>> >>> >> line 488, in one return self(1) File "sage/structure/parent.pyx", >>> >>> line >>> > 900, >>> >> in sage.structure.parent.Parent.__call__ >>> >> (build/cythonized/sage/structure/parent.c:9218) return >>> mor._call_(x) >>> >>> File >>> >> "sage/categories/map.pyx", line 1694, in >>> >> sage.categories.map.FormalCompositeMap._call_ >>> >> (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) >>> File >>> >> "sage/categories/morphism.pyx", line 549, in >>> >> sage.categories.morphism.SetMorphism._call_ >>> >> (build/cythonized/sage/categories/morphism.c:8489) cpdef Element >>> >> _call_(self, x): File "sage/categories/morphism.pyx", line 568, >>> in >>> >>
Re: [sage-devel] Possible bug: specifying category messes up coercion?
I agree, any reference to 1 should fail. But does the zero element of an algebra (i.e. its neutral element as a Z-module) really have to refer to the identity element of the algebra? Also, it probably should throw an error, instead of getting stuck in an infinite loop. Best, Akos On Friday, February 4, 2022 at 1:17:33 AM UTC+1 Travis Scrimshaw wrote: > As I stated on the ticket, this is not a bug because you have not properly > defined your algebra. It needs to have an (multiplicative) identity > specified as it is rightfully expecting it. This is the correct behavior > because you are saying it is an algebra without specifying what the algebra > structure is. In particular, you need to specify what one() is. > > Best, > Travis > > On Friday, February 4, 2022 at 7:49:19 AM UTC+9 vdelecroix wrote: > >> There is an explanation and a "solution" on the ticket. >> >> Best >> Vincent >> >> Le 03/02/2022 à 23:48, Akos M a écrit : >> > Replacing 0 with self.zero() works perfectly, thank you! >> > >> > Best, >> > Akos >> > >> > On Thursday, February 3, 2022 at 11:34:43 PM UTC+1 Akos M wrote: >> > >> >> Thanks for the feedback. >> >> >> >> Indeed, defined as such, C is a broken object - this was just the >> smallest >> >> example where I could reproduce the error. >> >> >> >> I was hoping that it should be possible to access the module elements >> >> without referring to 1, or multiplication. >> >> I would like to define multiplication later in the definition of some >> >> algebraic structure, but still inherit the methods from the category. >> >> (Similarly to >> >> >> https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html >> >> >> ) >> >> >> >> In particular, the error originally appeared in the form of >> >> "if x == 0:" >> >> where x is an element of the module, as should be 0 (now coerced..). >> >> >> >> Best, >> >> Akos >> >> On Thursday, February 3, 2022 at 10:10:29 PM UTC+1 vdelecroix wrote: >> >> >> >>> Now I am thinking about it, I am not sure it is a bug. You did >> >>> not defined any algebra structure (neither the unit nor the >> >>> product on the basis). C is definitely a broken object. >> >>> >> >>> However, it would make sense for C(0) not to call C(1). >> >>> >> >>> Vincent >> >>> >> >>> Le 03/02/2022 à 21:49, Akos M a écrit : >> Thanks, I created - my first - ticket. >> https://trac.sagemath.org/ticket/33285#ticket >> >> Once the ticket is (eventually) resolved, how do I update sage to >> >>> involve >> the resolution? >> >> Thanks, >> Akos >> >> On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: >> >> > It is definitely a bug. Do you know how to open >> > a ticket on the trac server ? >> > >> > The infinite loop comes from C.one() calling C(1) >> > calling C.one()... When you specify a category >> > the inheritance is different and this explains >> > the difference of behaviour. >> > >> > Best >> > Vincent >> > >> > Le 03/02/2022 à 11:29, Akos M a écrit : >> >> >> >> >> >> Hi, >> >> >> >> The snippet >> >> D = CombinatorialFreeModule(ZZ, [1,2]) D(0) >> >> >> >> works fine, however >> >> C = CombinatorialFreeModule(ZZ, [1,2], >> >>> category=AlgebrasWithBasis(ZZ)) >> > C(0) >> >> >> >> gets into an infinite loop: >> >> File >> >> >> > >> >>> >> "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", >> >> >> >>> >> >> line 488, in one return self(1) File "sage/structure/parent.pyx", >> >>> line >> > 900, >> >> in sage.structure.parent.Parent.__call__ >> >> (build/cythonized/sage/structure/parent.c:9218) return >> mor._call_(x) >> >>> File >> >> "sage/categories/map.pyx", line 1694, in >> >> sage.categories.map.FormalCompositeMap._call_ >> >> (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) >> File >> >> "sage/categories/morphism.pyx", line 549, in >> >> sage.categories.morphism.SetMorphism._call_ >> >> (build/cythonized/sage/categories/morphism.c:8489) cpdef Element >> >> _call_(self, x): File "sage/categories/morphism.pyx", line 568, in >> >> sage.categories.morphism.SetMorphism._call_ >> >> (build/cythonized/sage/categories/morphism.c:8439) return >> > self._function(x) >> >> File >> >> >> > >> >>> >> "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", >> >> >> >>> >> >> line 70, in from_base_ring return self.one()._lmul_(r) File >> >> "sage/misc/cachefunc.pyx", line 2310, in >> >> sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ >> >> (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = >> >> f(self._instance) >> >> >> >> Why is this? Is this expected behaviour? >> >> (Also asked
Re: [sage-devel] Possible bug: specifying category messes up coercion?
As I stated on the ticket, this is not a bug because you have not properly defined your algebra. It needs to have an (multiplicative) identity specified as it is rightfully expecting it. This is the correct behavior because you are saying it is an algebra without specifying what the algebra structure is. In particular, you need to specify what one() is. Best, Travis On Friday, February 4, 2022 at 7:49:19 AM UTC+9 vdelecroix wrote: > There is an explanation and a "solution" on the ticket. > > Best > Vincent > > Le 03/02/2022 à 23:48, Akos M a écrit : > > Replacing 0 with self.zero() works perfectly, thank you! > > > > Best, > > Akos > > > > On Thursday, February 3, 2022 at 11:34:43 PM UTC+1 Akos M wrote: > > > >> Thanks for the feedback. > >> > >> Indeed, defined as such, C is a broken object - this was just the > smallest > >> example where I could reproduce the error. > >> > >> I was hoping that it should be possible to access the module elements > >> without referring to 1, or multiplication. > >> I would like to define multiplication later in the definition of some > >> algebraic structure, but still inherit the methods from the category. > >> (Similarly to > >> > https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html > >> ) > >> > >> In particular, the error originally appeared in the form of > >> "if x == 0:" > >> where x is an element of the module, as should be 0 (now coerced..). > >> > >> Best, > >> Akos > >> On Thursday, February 3, 2022 at 10:10:29 PM UTC+1 vdelecroix wrote: > >> > >>> Now I am thinking about it, I am not sure it is a bug. You did > >>> not defined any algebra structure (neither the unit nor the > >>> product on the basis). C is definitely a broken object. > >>> > >>> However, it would make sense for C(0) not to call C(1). > >>> > >>> Vincent > >>> > >>> Le 03/02/2022 à 21:49, Akos M a écrit : > Thanks, I created - my first - ticket. > https://trac.sagemath.org/ticket/33285#ticket > > Once the ticket is (eventually) resolved, how do I update sage to > >>> involve > the resolution? > > Thanks, > Akos > > On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: > > > It is definitely a bug. Do you know how to open > > a ticket on the trac server ? > > > > The infinite loop comes from C.one() calling C(1) > > calling C.one()... When you specify a category > > the inheritance is different and this explains > > the difference of behaviour. > > > > Best > > Vincent > > > > Le 03/02/2022 à 11:29, Akos M a écrit : > >> > >> > >> Hi, > >> > >> The snippet > >> D = CombinatorialFreeModule(ZZ, [1,2]) D(0) > >> > >> works fine, however > >> C = CombinatorialFreeModule(ZZ, [1,2], > >>> category=AlgebrasWithBasis(ZZ)) > > C(0) > >> > >> gets into an infinite loop: > >> File > >> > > > >>> > "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", > >>> > >> line 488, in one return self(1) File "sage/structure/parent.pyx", > >>> line > > 900, > >> in sage.structure.parent.Parent.__call__ > >> (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) > >>> File > >> "sage/categories/map.pyx", line 1694, in > >> sage.categories.map.FormalCompositeMap._call_ > >> (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File > >> "sage/categories/morphism.pyx", line 549, in > >> sage.categories.morphism.SetMorphism._call_ > >> (build/cythonized/sage/categories/morphism.c:8489) cpdef Element > >> _call_(self, x): File "sage/categories/morphism.pyx", line 568, in > >> sage.categories.morphism.SetMorphism._call_ > >> (build/cythonized/sage/categories/morphism.c:8439) return > > self._function(x) > >> File > >> > > > >>> > "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", > >>> > >> line 70, in from_base_ring return self.one()._lmul_(r) File > >> "sage/misc/cachefunc.pyx", line 2310, in > >> sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ > >> (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = > >> f(self._instance) > >> > >> Why is this? Is this expected behaviour? > >> (Also asked on: > >> > > > >>> > https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/ > > ) > >> > >> Thanks, > >> Akos > >> > > > > >>> > >> > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/09693b3e-80f7-4c9e-b829-7b162d8d60a3n%40googlegroups.com.
Re: [sage-devel] Possible bug: specifying category messes up coercion?
There is an explanation and a "solution" on the ticket. Best Vincent Le 03/02/2022 à 23:48, Akos M a écrit : Replacing 0 with self.zero() works perfectly, thank you! Best, Akos On Thursday, February 3, 2022 at 11:34:43 PM UTC+1 Akos M wrote: Thanks for the feedback. Indeed, defined as such, C is a broken object - this was just the smallest example where I could reproduce the error. I was hoping that it should be possible to access the module elements without referring to 1, or multiplication. I would like to define multiplication later in the definition of some algebraic structure, but still inherit the methods from the category. (Similarly to https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html ) In particular, the error originally appeared in the form of "if x == 0:" where x is an element of the module, as should be 0 (now coerced..). Best, Akos On Thursday, February 3, 2022 at 10:10:29 PM UTC+1 vdelecroix wrote: Now I am thinking about it, I am not sure it is a bug. You did not defined any algebra structure (neither the unit nor the product on the basis). C is definitely a broken object. However, it would make sense for C(0) not to call C(1). Vincent Le 03/02/2022 à 21:49, Akos M a écrit : Thanks, I created - my first - ticket. https://trac.sagemath.org/ticket/33285#ticket Once the ticket is (eventually) resolved, how do I update sage to involve the resolution? Thanks, Akos On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: It is definitely a bug. Do you know how to open a ticket on the trac server ? The infinite loop comes from C.one() calling C(1) calling C.one()... When you specify a category the inheritance is different and this explains the difference of behaviour. Best Vincent Le 03/02/2022 à 11:29, Akos M a écrit : Hi, The snippet D = CombinatorialFreeModule(ZZ, [1,2]) D(0) works fine, however C = CombinatorialFreeModule(ZZ, [1,2], category=AlgebrasWithBasis(ZZ)) C(0) gets into an infinite loop: File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", line 488, in one return self(1) File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) File "sage/categories/map.pyx", line 1694, in sage.categories.map.FormalCompositeMap._call_ (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File "sage/categories/morphism.pyx", line 549, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8489) cpdef Element _call_(self, x): File "sage/categories/morphism.pyx", line 568, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8439) return self._function(x) File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", line 70, in from_base_ring return self.one()._lmul_(r) File "sage/misc/cachefunc.pyx", line 2310, in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = f(self._instance) Why is this? Is this expected behaviour? (Also asked on: https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/ ) Thanks, Akos -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/bd089958-fbd3-056a-72c9-1f3fa0bfb1e3%40gmail.com.
Re: [sage-devel] Possible bug: specifying category messes up coercion?
Replacing 0 with self.zero() works perfectly, thank you! Best, Akos On Thursday, February 3, 2022 at 11:34:43 PM UTC+1 Akos M wrote: > Thanks for the feedback. > > Indeed, defined as such, C is a broken object - this was just the smallest > example where I could reproduce the error. > > I was hoping that it should be possible to access the module elements > without referring to 1, or multiplication. > I would like to define multiplication later in the definition of some > algebraic structure, but still inherit the methods from the category. > (Similarly to > https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html > ) > > In particular, the error originally appeared in the form of > "if x == 0:" > where x is an element of the module, as should be 0 (now coerced..). > > Best, > Akos > On Thursday, February 3, 2022 at 10:10:29 PM UTC+1 vdelecroix wrote: > >> Now I am thinking about it, I am not sure it is a bug. You did >> not defined any algebra structure (neither the unit nor the >> product on the basis). C is definitely a broken object. >> >> However, it would make sense for C(0) not to call C(1). >> >> Vincent >> >> Le 03/02/2022 à 21:49, Akos M a écrit : >> > Thanks, I created - my first - ticket. >> > https://trac.sagemath.org/ticket/33285#ticket >> > >> > Once the ticket is (eventually) resolved, how do I update sage to >> involve >> > the resolution? >> > >> > Thanks, >> > Akos >> > >> > On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: >> > >> >> It is definitely a bug. Do you know how to open >> >> a ticket on the trac server ? >> >> >> >> The infinite loop comes from C.one() calling C(1) >> >> calling C.one()... When you specify a category >> >> the inheritance is different and this explains >> >> the difference of behaviour. >> >> >> >> Best >> >> Vincent >> >> >> >> Le 03/02/2022 à 11:29, Akos M a écrit : >> >>> >> >>> >> >>> Hi, >> >>> >> >>> The snippet >> >>> D = CombinatorialFreeModule(ZZ, [1,2]) D(0) >> >>> >> >>> works fine, however >> >>> C = CombinatorialFreeModule(ZZ, [1,2], >> category=AlgebrasWithBasis(ZZ)) >> >> C(0) >> >>> >> >>> gets into an infinite loop: >> >>> File >> >>> >> >> >> "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", >> >> >> >>> line 488, in one return self(1) File "sage/structure/parent.pyx", >> line >> >> 900, >> >>> in sage.structure.parent.Parent.__call__ >> >>> (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) >> File >> >>> "sage/categories/map.pyx", line 1694, in >> >>> sage.categories.map.FormalCompositeMap._call_ >> >>> (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File >> >>> "sage/categories/morphism.pyx", line 549, in >> >>> sage.categories.morphism.SetMorphism._call_ >> >>> (build/cythonized/sage/categories/morphism.c:8489) cpdef Element >> >>> _call_(self, x): File "sage/categories/morphism.pyx", line 568, in >> >>> sage.categories.morphism.SetMorphism._call_ >> >>> (build/cythonized/sage/categories/morphism.c:8439) return >> >> self._function(x) >> >>> File >> >>> >> >> >> "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", >> >> >> >>> line 70, in from_base_ring return self.one()._lmul_(r) File >> >>> "sage/misc/cachefunc.pyx", line 2310, in >> >>> sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ >> >>> (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = >> >>> f(self._instance) >> >>> >> >>> Why is this? Is this expected behaviour? >> >>> (Also asked on: >> >>> >> >> >> https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/ >> >> >> ) >> >>> >> >>> Thanks, >> >>> Akos >> >>> >> >> >> > >> > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/04a2ba26-a673-407d-aafb-dc44bcac02bdn%40googlegroups.com.
Re: [sage-devel] Possible bug: specifying category messes up coercion?
Thanks for the feedback. Indeed, defined as such, C is a broken object - this was just the smallest example where I could reproduce the error. I was hoping that it should be possible to access the module elements without referring to 1, or multiplication. I would like to define multiplication later in the definition of some algebraic structure, but still inherit the methods from the category. (Similarly to https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html) In particular, the error originally appeared in the form of "if x == 0:" where x is an element of the module, as should be 0 (now coerced..). Best, Akos On Thursday, February 3, 2022 at 10:10:29 PM UTC+1 vdelecroix wrote: > Now I am thinking about it, I am not sure it is a bug. You did > not defined any algebra structure (neither the unit nor the > product on the basis). C is definitely a broken object. > > However, it would make sense for C(0) not to call C(1). > > Vincent > > Le 03/02/2022 à 21:49, Akos M a écrit : > > Thanks, I created - my first - ticket. > > https://trac.sagemath.org/ticket/33285#ticket > > > > Once the ticket is (eventually) resolved, how do I update sage to involve > > the resolution? > > > > Thanks, > > Akos > > > > On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: > > > >> It is definitely a bug. Do you know how to open > >> a ticket on the trac server ? > >> > >> The infinite loop comes from C.one() calling C(1) > >> calling C.one()... When you specify a category > >> the inheritance is different and this explains > >> the difference of behaviour. > >> > >> Best > >> Vincent > >> > >> Le 03/02/2022 à 11:29, Akos M a écrit : > >>> > >>> > >>> Hi, > >>> > >>> The snippet > >>> D = CombinatorialFreeModule(ZZ, [1,2]) D(0) > >>> > >>> works fine, however > >>> C = CombinatorialFreeModule(ZZ, [1,2], category=AlgebrasWithBasis(ZZ)) > >> C(0) > >>> > >>> gets into an infinite loop: > >>> File > >>> > >> > "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", > >>> line 488, in one return self(1) File "sage/structure/parent.pyx", line > >> 900, > >>> in sage.structure.parent.Parent.__call__ > >>> (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) > File > >>> "sage/categories/map.pyx", line 1694, in > >>> sage.categories.map.FormalCompositeMap._call_ > >>> (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File > >>> "sage/categories/morphism.pyx", line 549, in > >>> sage.categories.morphism.SetMorphism._call_ > >>> (build/cythonized/sage/categories/morphism.c:8489) cpdef Element > >>> _call_(self, x): File "sage/categories/morphism.pyx", line 568, in > >>> sage.categories.morphism.SetMorphism._call_ > >>> (build/cythonized/sage/categories/morphism.c:8439) return > >> self._function(x) > >>> File > >>> > >> > "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", > >>> line 70, in from_base_ring return self.one()._lmul_(r) File > >>> "sage/misc/cachefunc.pyx", line 2310, in > >>> sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ > >>> (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = > >>> f(self._instance) > >>> > >>> Why is this? Is this expected behaviour? > >>> (Also asked on: > >>> > >> > https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/ > >> ) > >>> > >>> Thanks, > >>> Akos > >>> > >> > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/f1634604-9794-4af2-9dec-108455d5e6e5n%40googlegroups.com.
Re: [sage-devel] Possible bug: specifying category messes up coercion?
Now I am thinking about it, I am not sure it is a bug. You did not defined any algebra structure (neither the unit nor the product on the basis). C is definitely a broken object. However, it would make sense for C(0) not to call C(1). Vincent Le 03/02/2022 à 21:49, Akos M a écrit : Thanks, I created - my first - ticket. https://trac.sagemath.org/ticket/33285#ticket Once the ticket is (eventually) resolved, how do I update sage to involve the resolution? Thanks, Akos On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: It is definitely a bug. Do you know how to open a ticket on the trac server ? The infinite loop comes from C.one() calling C(1) calling C.one()... When you specify a category the inheritance is different and this explains the difference of behaviour. Best Vincent Le 03/02/2022 à 11:29, Akos M a écrit : Hi, The snippet D = CombinatorialFreeModule(ZZ, [1,2]) D(0) works fine, however C = CombinatorialFreeModule(ZZ, [1,2], category=AlgebrasWithBasis(ZZ)) C(0) gets into an infinite loop: File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", line 488, in one return self(1) File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) File "sage/categories/map.pyx", line 1694, in sage.categories.map.FormalCompositeMap._call_ (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File "sage/categories/morphism.pyx", line 549, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8489) cpdef Element _call_(self, x): File "sage/categories/morphism.pyx", line 568, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8439) return self._function(x) File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", line 70, in from_base_ring return self.one()._lmul_(r) File "sage/misc/cachefunc.pyx", line 2310, in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = f(self._instance) Why is this? Is this expected behaviour? (Also asked on: https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/ ) Thanks, Akos -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/a88b1d6a-5632-df2d-8b47-06d6badaf67f%40gmail.com.
Re: [sage-devel] Possible bug: specifying category messes up coercion?
Thanks for creating the ticket. Once the ticket is solved there are two routes to obtain a version of SageMath including the fix. * Either you obtain the corresponding git branch that will be attached to the ticket and compile this version of the source code * Or wait for a release of SageMath that will include the fix But first things first : the issue has to be solved! Best Vincent Le 03/02/2022 à 21:49, Akos M a écrit : Thanks, I created - my first - ticket. https://trac.sagemath.org/ticket/33285#ticket Once the ticket is (eventually) resolved, how do I update sage to involve the resolution? Thanks, Akos On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: It is definitely a bug. Do you know how to open a ticket on the trac server ? The infinite loop comes from C.one() calling C(1) calling C.one()... When you specify a category the inheritance is different and this explains the difference of behaviour. Best Vincent Le 03/02/2022 à 11:29, Akos M a écrit : Hi, The snippet D = CombinatorialFreeModule(ZZ, [1,2]) D(0) works fine, however C = CombinatorialFreeModule(ZZ, [1,2], category=AlgebrasWithBasis(ZZ)) C(0) gets into an infinite loop: File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", line 488, in one return self(1) File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) File "sage/categories/map.pyx", line 1694, in sage.categories.map.FormalCompositeMap._call_ (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File "sage/categories/morphism.pyx", line 549, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8489) cpdef Element _call_(self, x): File "sage/categories/morphism.pyx", line 568, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8439) return self._function(x) File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", line 70, in from_base_ring return self.one()._lmul_(r) File "sage/misc/cachefunc.pyx", line 2310, in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = f(self._instance) Why is this? Is this expected behaviour? (Also asked on: https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/ ) Thanks, Akos -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/6dde336c-2c69-3e56-be9d-3ac485bf983e%40gmail.com.
Re: [sage-devel] Possible bug: specifying category messes up coercion?
Thanks, I created - my first - ticket. https://trac.sagemath.org/ticket/33285#ticket Once the ticket is (eventually) resolved, how do I update sage to involve the resolution? Thanks, Akos On Thursday, February 3, 2022 at 1:39:10 PM UTC+1 vdelecroix wrote: > It is definitely a bug. Do you know how to open > a ticket on the trac server ? > > The infinite loop comes from C.one() calling C(1) > calling C.one()... When you specify a category > the inheritance is different and this explains > the difference of behaviour. > > Best > Vincent > > Le 03/02/2022 à 11:29, Akos M a écrit : > > > > > > Hi, > > > > The snippet > > D = CombinatorialFreeModule(ZZ, [1,2]) D(0) > > > > works fine, however > > C = CombinatorialFreeModule(ZZ, [1,2], category=AlgebrasWithBasis(ZZ)) > C(0) > > > > gets into an infinite loop: > > File > > > "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", > > line 488, in one return self(1) File "sage/structure/parent.pyx", line > 900, > > in sage.structure.parent.Parent.__call__ > > (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) File > > "sage/categories/map.pyx", line 1694, in > > sage.categories.map.FormalCompositeMap._call_ > > (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File > > "sage/categories/morphism.pyx", line 549, in > > sage.categories.morphism.SetMorphism._call_ > > (build/cythonized/sage/categories/morphism.c:8489) cpdef Element > > _call_(self, x): File "sage/categories/morphism.pyx", line 568, in > > sage.categories.morphism.SetMorphism._call_ > > (build/cythonized/sage/categories/morphism.c:8439) return > self._function(x) > > File > > > "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", > > line 70, in from_base_ring return self.one()._lmul_(r) File > > "sage/misc/cachefunc.pyx", line 2310, in > > sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ > > (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = > > f(self._instance) > > > > Why is this? Is this expected behaviour? > > (Also asked on: > > > https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/ > ) > > > > Thanks, > > Akos > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/336bde25-415a-4107-8328-6e1fd3eac03an%40googlegroups.com.
Re: [sage-devel] Possible bug: specifying category messes up coercion?
It is definitely a bug. Do you know how to open a ticket on the trac server ? The infinite loop comes from C.one() calling C(1) calling C.one()... When you specify a category the inheritance is different and this explains the difference of behaviour. Best Vincent Le 03/02/2022 à 11:29, Akos M a écrit : Hi, The snippet D = CombinatorialFreeModule(ZZ, [1,2]) D(0) works fine, however C = CombinatorialFreeModule(ZZ, [1,2], category=AlgebrasWithBasis(ZZ)) C(0) gets into an infinite loop: File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", line 488, in one return self(1) File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) File "sage/categories/map.pyx", line 1694, in sage.categories.map.FormalCompositeMap._call_ (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File "sage/categories/morphism.pyx", line 549, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8489) cpdef Element _call_(self, x): File "sage/categories/morphism.pyx", line 568, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8439) return self._function(x) File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", line 70, in from_base_ring return self.one()._lmul_(r) File "sage/misc/cachefunc.pyx", line 2310, in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = f(self._instance) Why is this? Is this expected behaviour? (Also asked on: https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/) Thanks, Akos -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/3ae00851-5b8b-b24f-f771-8624e903a18d%40gmail.com.
[sage-devel] Possible bug: specifying category messes up coercion?
Hi, The snippet D = CombinatorialFreeModule(ZZ, [1,2]) D(0) works fine, however C = CombinatorialFreeModule(ZZ, [1,2], category=AlgebrasWithBasis(ZZ)) C(0) gets into an infinite loop: File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/magmas.py", line 488, in one return self(1) File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218) return mor._call_(x) File "sage/categories/map.pyx", line 1694, in sage.categories.map.FormalCompositeMap._call_ (build/cythonized/sage/categories/map.c:11607) x = f._call_(x) File "sage/categories/morphism.pyx", line 549, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8489) cpdef Element _call_(self, x): File "sage/categories/morphism.pyx", line 568, in sage.categories.morphism.SetMorphism._call_ (build/cythonized/sage/categories/morphism.c:8439) return self._function(x) File "/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/categories/unital_algebras.py", line 70, in from_base_ring return self.one()._lmul_(r) File "sage/misc/cachefunc.pyx", line 2310, in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (build/cythonized/sage/misc/cachefunc.c:12712) self.cache = f(self._instance) Why is this? Is this expected behaviour? (Also asked on: https://ask.sagemath.org/question/60903/possible-bug-specifying-category-messes-up-coercion/) Thanks, Akos -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/6c814813-e7aa-4e13-8902-e574d45032f4n%40googlegroups.com.