-
-
Notifications
You must be signed in to change notification settings - Fork 698
Closed
Description
Matrices with prescribed density are not generated correctly:
sage: M = random_matrix(GF(65537), 100, 100, sparse=True, density=0.1)
sage: len(M.nonzero_positions())
940
sage: M = random_matrix(GF(2), 100, 100, sparse=True, density=0.1)
sage: len(M.nonzero_positions())
465
To wit: the actual density of the matrix over GF(2) is only approximately half of what we expect. This happens because the randomize() function populating the entries does not check whether the random element picked actually is non-zero. Apparently, all of the matrix classes are affected by this bug.
CC: @craigcitro
Component: linear algebra
Author: Sebastian Pancratz
Reviewer: Tom Boothby, Craig Citro
Merged: sage-4.3.2.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/3436