[sage-devel] Re: direct sums, products and other categorical constructions
On Wednesday, May 22, 2019 at 7:25:26 AM UTC-7, Simon King wrote: > > > I tend to argue that in the first place, SageMath is a maths software. > And mathematically, universal constructions do come "with batteries" > included. Hence, the projections and coprojections are part of the > construction and it makes sense to let them be part of the constructed > objects. > > I don't think you have to come to that conclusion. As the routine V.direct_sum says, it returns the direct sum as a free module, Of course the projections and coprojections should be available (either between the module and an explicit cartesian product, or as separate projections maps and section maps (possibly with the section stored on the projection), but if the direct sum is modelled as a free module (and for efficiency reasons you have to) then there is not really room to store these objects on that module itself. Plus, doing so opens up another can of memory leak problems. Using the coercion framework to store the projections and coprojections is similarly problematic: there is no satisfactory answer to which object should keep which alive. Plus, with direct powers, it's not so clear where to project. Returning the object as an element in an already implemented category together with the maps that follow naturally from the construction is definitely workable, and probably the most "basic" way of capturing the required datta. So I'd argue we should at least implement that basic interface. If someone wants to put some further sauce on that, it can be built on top. -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/2fafda47-c40e-4c0f-9ac7-582cb8c55e2c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Error building the documentation with 8.8.beta5
Let us know if you find a way to fix that. All my attempts failed (make doc-clean, dist-clean) David. Le mardi 21 mai 2019 10:35:38 UTC+2, Nicolas M. Thiéry a écrit : > > > Just for the record: same error here on Balthazar's laptop, sage > 8.8.beta5, fresh Ubuntu 18.04. > > Cheers, > Nicolas > -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/49ab55c5-76aa-4af3-9df6-716d3853106c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: direct sums, products and other categorical constructions
Hi Vincent, On 2019-05-22, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > I am not a big fan of bundling everything into a single > bigger object. What about returning a triple > (V, projections, coprojections)? I tend to argue that in the first place, SageMath is a maths software. And mathematically, universal constructions do come "with batteries" included. Hence, the projections and coprojections are part of the construction and it makes sense to let them be part of the constructed objects. Here is a similar situation: When applying a construction functor, then often a natural homomorphism is involved that is turned into a coercion map and is thus part of the constructed object (a polynomial ring knows the coercion map from its base ring). I could imagine the following model: - We do want unique parents. I.e., QQ^4 is unique. - We want that the direct sum of QQ and QQ^3 yields different coprojections than the direct sum of QQ^2 and QQ^2, even though the constructed vector space is in both cases the same object, namely QQ^4. - Hence, a universal construction should be a wrapper. QQ^2+QQ^2 and QQ+QQ^3 would be two different wrappers of the same object, each providing different coprojections. Perhaps the "Facade" framework can be used to implement it? Best regards, Simon -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/qc3m49%247ams%241%40blaine.gmane.org. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: show() method for all sage objects
Hi Eric, On 2019-05-22, Eric Gourgoulhon wrote: > According to > https://ipython.readthedocs.io/en/stable/config/integrating.html > if _repr_latex_() returns None then it falls back to repr(). So a strategy > could be to implement _repr_latex_ in SageObject (I guess all Cython > objects are inhereting from it) as follows: > > def _repr_latex_(self): > from sage.misc.latex import latex > if not hasattr(self, '_latex_'): > return None > return '$' + str(latex(self)) + '$' That sounds reasonable to me, and is basically what we do with Python's magical (double underscore) methods (namely: provide a reasonable default that shouldn't be overridden). Best regards, Simon -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/qc3lan%244di2%241%40blaine.gmane.org. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] direct sums, products and other categorical constructions
I am not a big fan of bundling everything into a single bigger object. What about returning a triple (V, projections, coprojections)? Le 22/05/2019 à 11:19, Simon Brandhorst a écrit : Right now I can do sage: V = ZZ^2 sage: D = V.direct_sum(V) sage: D Free module of degree 4 and rank 4 over Integer Ring Echelon basis matrix: [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1] But the result has forgotten that it is a direct sum. Of a direct sum I expect, that it has a projection and a co-projection. (this is how it is done in gap) So I want to be able to type sage: D.projection(0) sage: D.coprojection(0) Then there could also be appropriate coercions. The same holds for other direct sums in groups, vector spaces Or for other constructions like a direct product, inverse limit ... Maybe this is something for the category framework? How would one implement it? -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/30fe5920-98ea-6056-9123-21c66b810e0d%40gmail.com. For more options, visit https://groups.google.com/d/optout.
[sage-devel] direct sums, products and other categorical constructions
Right now I can do sage: V = ZZ^2 sage: D = V.direct_sum(V) sage: D Free module of degree 4 and rank 4 over Integer Ring Echelon basis matrix: [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1] But the result has forgotten that it is a direct sum. Of a direct sum I expect, that it has a projection and a co-projection. (this is how it is done in gap) So I want to be able to type sage: D.projection(0) sage: D.coprojection(0) Then there could also be appropriate coercions. The same holds for other direct sums in groups, vector spaces Or for other constructions like a direct product, inverse limit ... Maybe this is something for the category framework? How would one implement it? -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/06759b84-6026-47f2-911f-5de2503c3e1a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: show() method for all sage objects
Le mercredi 22 mai 2019 10:49:33 UTC+2, Eric Gourgoulhon a écrit : > > I've tested the code above and it fully solves > https://trac.sagemath.org/ticket/23330 > > PS: if someone would like to have a look, I've pushed the code to the trac branch: https://git.sagemath.org/sage.git/commit/?h=u/egourgoulhon/repr_latex=97eaa385aef7761b52b202b98f846fc60bdf40a2 -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/b7a0b9f8-81b5-4b40-a73f-f5e7a3501e0b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: show() method for all sage objects
Hi Simon, Le mercredi 22 mai 2019 09:15:10 UTC+2, Simon King a écrit : > > A lot of Sage objects are written in Cython. So, a potential problem of > that approach would be multiple inheritance. > > Ah yes, that's right... According to https://ipython.readthedocs.io/en/stable/config/integrating.html if _repr_latex_() returns None then it falls back to repr(). So a strategy could be to implement _repr_latex_ in SageObject (I guess all Cython objects are inhereting from it) as follows: def _repr_latex_(self): from sage.misc.latex import latex if not hasattr(self, '_latex_'): return None return '$' + str(latex(self)) + '$' This assumes that if an object has a _latex_ method, it works properly... I've tested the code above and it fully solves https://trac.sagemath.org/ticket/23330 Best regards, Eric. -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/a7253878-9f13-4545-bcb5-4446c0fb5393%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: show() method for all sage objects
Hi Eric, On 2019-05-21, Eric Gourgoulhon wrote: > Le lundi 20 mai 2019 07:55:30 UTC+2, Kwankyu Lee a écrit : >> >> . Moreover many sage objects currently are displayed broken if typeset. >> > > In that case, a solution could be to introduce a new class, > TypesetSageObject, say, to implement _repr_latex_() in it and to make Sage > objects that can be correctly typeset inheritate from it. > For instance, this could be done for all manifold objects and for symbolic > expressions (class Expression). A lot of Sage objects are written in Cython. So, a potential problem of that approach would be multiple inheritance. Best regards, Simon -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/qc2stk%244l8r%241%40blaine.gmane.org. For more options, visit https://groups.google.com/d/optout.