Hi Martin! On Sep 4, 12:33 pm, Martin Albrecht <m...@informatik.uni-bremen.de> wrote: [..] > Think this would be rather un-pythonic: converting an object into a string > instead of using it directly. > > > But what about block orderings? If one allows a matrix ordering to be > > defined by a matrix, then I guess the blocks should be listed: > > sage: P.<a,b,c,d,e> = PolynomialRing(QQ,5,order=[M,'degrevlex']) > > Have you seen this? > > sage: TermOrder('deglex',3) + TermOrder('degrevlex',2) > deglex(3),degrevlex(2) term order
Meanwhile I've also seen the code of TermOrder.__add__. It is rather un-pythonic, as it entirely relies on working with strings. Namely: ... name = [] for block_order in self.blocks + other.blocks: nom = block_order.singular_str() name.append("%s(%d)"%(inv_singular_name_mapping.get (nom,nom), len(block_order))) name = ",".join(name) return TermOrder(name, len(self)+len(other)) In other words, for each block, the defining string for the order in Singular is translated into a defining string for the order in Sage, by a dictionary lookup (inv_singular_name_mapping.get(nom,nom), then everything is concatenated and given as the input to TermOrder.__init__. Problem: singular_str() for a matrix order will be M(1,3,1,0,...), where the number of integers between the brackets depends on the lengths. This can't be dealt with by a simple dictionary lookup. So, a proper support of Matrix orders will be more work, and wrapping things in libsingular will not suffice. Best regards, Simon --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---