On Tue, 26 Feb 2019 at 17:01, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
> I don't think this has ever been implemented in Sage. You > have to figure out how to create a sparse matrix in magma > and write Sage code to produce it. You can get inspiration > from the current code of _magma_init_ > > def _magma_init_(self): > P = magma(self.parent()) > v = [x._magma_init_(magma) for x in self.list()] > return '%s![%s]'%(P.name(), ','.join(v)) > > Vincent > This would be a very useful addition (for some people). Magma constructs sparse matrices using SparseMatrix() with several interfaces including (m::RngIntElt, n::RngIntElt, Q::SeqEnum[Tup]) -> MtrxSprs The m by n sparse matrix, whose entries are given by the tuples in Q of the form <i, j, x> (specifying that x is at entry (i, j)). Example: > M:=SparseMatrix(3,3,[<1,1,1>,<2,2,1>,<3,3,1>]); > IdentitySparseMatrix(Integers(), 3) eq M; true > > Le 26/02/2019 à 17:55, Pierre Guillot a écrit : > > Thanks! I think to know where the issue is : > > > > M= random_matrix(ZZ, 10, sparse= True, density= 0.1) > > M._magma_init_(magma) > > > > > '_sage_[11]![0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-14,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,0,0,0,0]' > > > > > > This does not look like a sparse matrix to me : it's been converted to a > > "dense" matrix before magma code was produced... > > > > no wonder if my 50,000 x 50,000 matrix takes forever to load... > > > > If anyone has an easy fix, it would be great. Otherwise, i'll have to > learn > > the syntax for sparse matrices in magma, and figure out how magma reads > > from a file... > > > > > > > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.