def main():
   """
   Generates a matrix with given eigenvalues
   and launches the animation.
   """
   print 'Running the power method...'
   n = input('Give the dimension : ')
   # m = input('Convergence factor ? ')
   m = 1.2
   L = np.random.uniform(0,2*np.pi,n)
   j = complex(0,1)
   K = np.exp(j*L)
   for i in range(1,len(K)): K[i] = K[i]/m
   A = generate_matrix(K)
   p = Power_Method(n,eps=1.0e-2,A=A);
   animate(p)
def main():
   """
   Prompts the user for a dimension
   and the number of iterations.
   """
   print 'Running the power method...'
   n = input('Give the dimension : ')
   m = input('Convergence factor ? ')
   L = np.random.uniform(0,2*np.pi,n)
   j = complex(0,1)
   K = np.exp(j*L)
   for i in range(1,len(K)): K[i] = K[i]/m
   A = generate_matrix(K)
   p = Power_Method(n,A=A);
   for i in range(1000):
      p.next()
      print p
      if p.accurate(): break