def test_this_det(n, y, mind_time):
    global t0, t1
    a = matrix_with_det(dim, y)
    # print 'source matrice A with abs(det)=%X:\n' % y,a
    a = fmpz_mat(a)
    m0 = time.time()
    z = count_det(a)
    m1 = time.time()
    h = flint.det_hermitian_decomposition(a)
    m2 = time.time()
    assert abs(z) == y
    if h != z:
        print "det mismatch: z=%X != %X" % (z, h)
        assert 0
    if mind_time:
        t0 += m1 - m0
        t1 += m2 - m1
예제 #2
0
def det_RAZIN(a):
 return flint.det_hermitian_decomposition( fmpz_mat(a) )
    h = flint.det_hermitian_decomposition(a)
    m2 = time.time()
    assert abs(z) == y
    if h != z:
        print "det mismatch: z=%X != %X" % (z, h)
        assert 0
    if mind_time:
        t0 += m1 - m0
        t1 += m2 - m1


if 1:
    print "testing simple diagonal matrice"
    x = identity_matrix(5)
    for i in range(2, 200):
        x[0, 0] = (3 * 5) << i
        d = flint.det_hermitian_decomposition(fmpz_mat(x))
        if x[0, 0] != d:
            print "test failed for i=%s" % i
            print "(hex) %X != %X" % (x[0, 0], d)
            sys.exit(1)

sage.all.set_random_seed("20140831")

t0 = t1 = 0
for dim in range(3, 30):
    write("%s " % dim)
    test_for_dim(dim)

print "\ntest passed"