allow for negative integer matrices as well
This commit is contained in:
parent
a680f4bbd9
commit
70851add1d
@ -7,7 +7,7 @@ errs = (ValueError, TypeError)
|
|||||||
|
|
||||||
def genmatrix(rowcol, intmax, dif) :
|
def genmatrix(rowcol, intmax, dif) :
|
||||||
# generate a random matrices
|
# generate a random matrices
|
||||||
a = sp.randMatrix(rowcol, rowcol, 0, intmax)
|
a = sp.randMatrix(rowcol, rowcol, -intmax, intmax)
|
||||||
# if determinant non-zero, radnom value less than difficulty, set a to its inverse
|
# if determinant non-zero, radnom value less than difficulty, set a to its inverse
|
||||||
if a.det() != 0 and random.random() <= dif :
|
if a.det() != 0 and random.random() <= dif :
|
||||||
a = a.inv()
|
a = a.inv()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user