span and submodule are defined for free modules over a PID only. Perhaps there definition could be moved up to FreeModule_generic. There could still be special code for PIDs, for example the part which echelonises bases. I don't know what the equivalent of an echelonised basis is for modules over Integers(n), but it must be possible to define such a thing.
John 2008/9/24 David Joyner <[EMAIL PROTECTED]>: > > On Wed, Sep 24, 2008 at 3:27 AM, mabshoff <[EMAIL PROTECTED]> wrote: >> >> On Sep 24, 12:16 am, cesarnda <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >>> I have coded a program in cython called "elements_in_linear_span" that >>> generates a set of codewords from a matrix (a matrix space must be >>> defined) over a ring of intergers. This function almost does what >>> Magma does with: >>> >>> > R:=RingOfIntegers(9); >>> > code := LinearCode(sub<RSpace(R,5)|[5, 0, 0, 0, 4],[4, 5, 0, 0, 0],[0, 4, >>> > 5, 0, 0],[0, 0, 4, 5, 0], [0, 0, 0, 4, 5]>); >>> >>> The differences are that my program does not get the matrix in echelon >>> form and it does not get the minimum distance of the code (which I >>> think I might have an example where Magma does not compute it right). >>> >>> The great advantage of this program is that it does something that >>> Sage does not do yet and it does it almost as fast as Magma (less than >>> one second, 0.89 sec the longest yet, meanwhile Magma does it in >>> almost 0 seconds). >> >> I assume this is a typo? >> >>> David Joyner have checked the results of this program compared to >>> Magma's and the construction is almost similar: >>> >>> sage: MS = MatrixSpace(IntegerModRing(9), 5,5) >>> sage: G = MS([[5, 0, 0, 0, 4],[4, 5, 0, 0, 0],[0, 4, 5, 0, 0],[0, 0, >>> 4, 5, 0], [0, 0, 0, 4, 5]]) >>> sage: elements_in_linear_span(G) >>> >>> So this function might be a good addition for a list method for the >>> elements of a free module over ZZ/nZZ. >>> >>> What do you think? >> >> Great. Are you willing to contribute the code under GPL V2+ (or a >> compatible license) to the Sage library? There are likely some things >> to be cleaned up, doctests and potentailly documentation added and so >> on. Maybe David can give us his point of view on that code since he >> has seen it. > > > It is Cython and not in "Sage's format" (as it is a stand-alone program > at the moment). I wonder if someone can suggest where to add it. > For example, it would be great if his code could be used to compute > the list of a submodule as follows: > > > sage: R = IntegerModRing(8) > sage: V = FreeModule(R,10) > sage: b1 = V([1,2,3,2,3,4,5,6,7,-1]) > sage: b2 = V([1,0,3,1,3,4,1,6,1,-1]) > sage: W = V.submodule([b1,b2]) # hypothetical > sage: W.list() # hypothetical > > > However, AFAIK there is no submodule or span of a free module > over a finite ring (which is not a field). So the line above that also > is hypothetical. It seems to me that the submodule method > would have to be written first and this might involve the creation of > a new class. I have not poked around the free module code though > and really someone familiar with that (and also familiar with > Cython) should comment. > > Maybe the best place to do this would be at a SageDays? > > >> >> Cheers, >> >> Michael >> > >> > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---