Пример #1
0
def check_dim(n):
 a=identity_matrix(n)
 do_with(a)
 a[0,0]=1+2*randint(-99,99)
 do_with(a)
 a[n-1,n-1]=1+2*randint(-99,99)
 do_with(a)
 a[0,0],  a[0,n-1]  =0,1
 a[n-1,0],a[n-1,n-1]=1,0
 do_with(a)
 for i in range(5):
  do_with( unimodular_triL(n,9) )
  do_with( unimodular_triU(n,9) )
  do_with( odd_hermite(n,4) )
  do_with( odd_hermite(n,4).T )
  do_with( unimodular(n)*odd_hermite(n,99) )
  do_with( unimodular(n)*unimodular_diag(n)*odd_hermite(n,99) )
def test_serie_1(dim,vol,loud):
 if dim<20:
  max_k=dim+1
 else:
  max_k=21
 for k in range(1,max_k):
  assert k <= dim
  for x in range(vol):
   ' create matrice with abs(det)<2**63 and diagonal with k entries>1 '
   nums=small_nums(k)
   A=sage.all.identity_matrix(ZZ,dim)
   for i in range(k-1):
    A[i,i]=nums[i]
   A[dim-1,dim-1]=nums[k-1]
   A *= unimodular(dim)
   A *= unimodular(dim)
   A=left_trans(A,dim)
   A=left_trans(A,dim)
   test(A,loud)
def test_serie_1(be, m, c, vol):
    if c < 30:
        max_k = c + 1
    else:
        max_k = 30
    for x in range(vol):
        for k in range(1, max_k):
            assert k <= c
            " create matrice with abs(det)<2**128 and diagonal with k entries>1 "
            nums = small_nums(k)
            A = identity_matrix(ZZ, c)
            if m > c:
                A = A.stack(matrix(m - c, c))
            for i in range(k - 1):
                A[i, i] = nums[i]
            A[c - 1, c - 1] = nums[k - 1]
            A *= unimodular(c)
            A = left_trans(A, m)
            d = three_det_divisors(nums)
            test_serie_2(be, A, d)
        # don't start new iteration if too many experiments done
        if be[-1] >= 1000:
            return
Пример #4
0
def test_serie_1(m,c,vol,loud):
 if c<30:
  max_k=c+1
 else:
  max_k=30
 for k in range(1,max_k):
  assert k <= c
  for x in range(vol):
   ' create matrice with abs(det)<2**128 and diagonal with k entries>1 '
   nums=small_nums(k)
   A=identity_matrix(ZZ,c)
   if m>c:
    A=A.stack( matrix( m-c, c ) )
   for i in range(k-1):
    A[i,i]=nums[i]
   A[c-1,c-1]=nums[k-1]
   A *= unimodular(c)
   A=left_trans(A,m)
   d=three_det_divisors( nums )
   if 1:
    write('.')
   else:
    print 'nums=%s divisors=%s' % (nums,d)
   test_serie_2(A,d,loud)
Пример #5
0
def matrix_with_det(n, d):
    x = identity_matrix(n)
    x[0, 0] = d
    return x * unimodular(n)
Пример #6
0
def matrix_with_det( n, d ):
 if n==5 and LOUD_5:
  print 'testing matrice with det=%d' % d
 x=identity_matrix(n)
 x[0,0]=d
 return x * unimodular(n)