Example #1
0
def test_dump_r(nrows=10):
    A = IntegerMatrix(nrows, nrows)
    A.randomize("ntrulike", bits=10, q=1023)
    M = GSO.Mat(A)
    if not have_numpy:
        return

    M.update_gso()
    r = dump_r(M, 0, nrows)

    for i in range(nrows):
        assert abs(M.get_r(i, i) - r[i]) < 0.001
Example #2
0
def test_dump_r(nrows=10):
    A = IntegerMatrix(nrows, nrows)
    A.randomize("ntrulike", bits=10, q=1023)
    M = GSO.Mat(A)
    if not have_numpy:
        return

    M.update_gso()
    r = dump_r(M, 0, nrows)

    for i in range(nrows):
        assert abs(M.get_r(i, i) - r[i]) < 0.001
Example #3
0
def test_dump_mu(nrows=10):
    A = IntegerMatrix(nrows, nrows)
    A.randomize("ntrulike", bits=10, q=1023)
    M = GSO.Mat(A)
    if not have_numpy:
        return

    M.update_gso()
    mu = dump_mu(M, 0, nrows)

    for i in range(nrows):
        for j in range(i):
            assert abs(M.get_mu(i, j) - mu[i, j]) < 0.001
Example #4
0
def test_dump_mu(nrows=10):
    A = IntegerMatrix(nrows, nrows)
    A.randomize("ntrulike", bits=10, q=1023)
    M = GSO.Mat(A)
    if not have_numpy:
        return

    M.update_gso()
    mu = dump_mu(M, 0, nrows)

    for i in range(nrows):
        for j in range(nrows):
            assert abs(M.get_mu(i, j) - mu[i, j]) < 0.001
Example #5
0
def test_dump_r(nrows=10):
    A = IntegerMatrix(nrows, nrows)
    A.randomize("ntrulike", bits=10, q=1023)
    M  = GSO.Mat(A)
    if not have_numpy:
        return

    r = numpy.ndarray(dtype='double', shape=nrows)

    M.update_gso()
    dump_r(r, M, 0, nrows)

    for i in range(nrows):
        assert abs(M.get_r(i, i) - r[i]) < 0.001
Example #6
0
def test_dump_mu(nrows=10):
    A = IntegerMatrix(nrows, nrows)
    A.randomize("ntrulike", bits=10, q=1023)
    M  = GSO.Mat(A)
    if not have_numpy:
        return

    mu = numpy.ndarray(dtype='double', shape=(nrows, nrows))

    M.update_gso()
    dump_mu(mu, M, 0, nrows)

    for i in range(nrows):
        for j in range(nrows):
            assert abs(M.get_mu(i, j) - mu[i, j]) < 0.001
Example #7
0
def make_integer_matrix(m, n):
    A = IntegerMatrix(m, n)
    A.randomize("uniform", bits=m+n)
    return A
Example #8
0
def make_integer_matrix(m, n):
    A = IntegerMatrix(m, n)
    A.randomize("uniform", bits=m + n)
    return A
Example #9
0
def make_integer_matrix(d, int_type="mpz"):
    A = IntegerMatrix(d, d, int_type=int_type)
    A.randomize("qary", k=d // 2, bits=10)
    return A
Example #10
0
def make_integer_matrix(m, n, int_type="mpz"):
    A = IntegerMatrix(m, n, int_type=int_type)
    A.randomize("uniform", bits=20)
    return A
Example #11
0
def make_integer_matrix(m, n, int_type="mpz"):
    A = IntegerMatrix(m, n, int_type=int_type)
    A.randomize("qary", k=m // 2, bits=m)
    return A
Example #12
0
def make_integer_matrix(m, n):
    A = IntegerMatrix(m, n)
    A.randomize(algorithm="ntrulike", bits=30, q=2147483647)
    return A
Example #13
0
def make_integer_matrix(m, n, int_type="mpz"):
    A = IntegerMatrix(m, n, int_type=int_type)
    A.randomize("qary", bits=20, k=min(m, n) // 2)
    return A