On 2/21/07, Iftikhar Burhanuddin <[EMAIL PROTECTED]> wrote:
>
> Hi folks,
>
> Random sparse matrices over finite fields generated by SAGE do not look 
> sparse to me. Bug?
>
> sage: Mat(GF(17), 10, sparse=True).random_element()

Ifti,
looking at the docs for random_element(), it looks like you need to
specify another argument to get a sparse matrix:

{{{
sage: MS = MatrixSpace(ZZ,10,sparse=True); MS.random_element (density=0.4)

[ 0  0  0  0  0  0 -2 -1  0  0]
[ 0  0  0  1 -2  0  0  0  0  0]
[-2  1  0  0  0  0  0  0  2  0]
[ 0 -2  1  2 -2  0  0  0  0  0]
[ 2  0  0  2  0  0  2  0 -1  0]
[ 0  0  0  0  1  0 -2 -1 -1  0]
[ 2  0  2  0  0  0  0  2  0 -2]
[ 0 -1  0  0  0  2 -2  0 -1  0]
[ 0  0  0  0  0  2  0  0  0  2]
[ 0  0  0 -2  0 -2  0  2 -1  1]

}}}

This seems somewhat counter-intuitive to me. Maybe there should be a
self._density that gets set to something like 0.3 when
self.__is_sparse is True?

Another idea: maybe we should be able to set the density directly:

{{{
MS = MatrixSpace(ZZ,10,sparse=True,density=0.4)
}}}

although this seems redundant to me...

didier

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@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-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to