# HG changeset patch
# User Rob Beezer <beezer@ups.edu>
# Date 1301203798 25200
# Node ID 1f2f69aed28b5eac302b6bcf790b3948a4e34b3a
# Parent 9bf40613dbca3acfc33762f3c01774df48f4f9f4
10791: doctest edits for GramSchmidt routines
diff r 9bf40613dbca r 1f2f69aed28b sage/matrix/matrix2.pyx
a

b


6066  6066  to arrive at an orthonormal set, it must be possible to construct 
6067  6067  square roots of the elements of the base field. In Sage, your 
6068  6068  best option is the field of algebraic numbers, ``QQbar``, which 
6069   properly contain the rationals and number fields. 
 6069  properly contains the rationals and number fields. 
6070  6070  
6071  6071  If you have an approximate numerical matrix, then this routine 
6072  6072  requires that your base field be the real and complex 
… 
… 

6075  6075  attempt is made to recognize linear dependence with approximate 
6076  6076  calculations. 
6077  6077  
6078   EXAMPLES:: 
 6078  EXAMPLES: 
6079  6079  
6080  6080  Inexact Rings, Numerical Matrices: 
6081  6081  
… 
… 

6146  6146  
6147  6147  To scale a vector to unit length requires taking 
6148  6148  a square root, which often takes us outside the base ring. 
6149   For the integers, and rationals the field of algebraic numbers, 
6150   ``QQbar``, is big enough to contain what we need, but the price 
 6149  For the integers and the rationals, the field of algebraic numbers 
 6150  (``QQbar``) is big enough to contain what we need, but the price 
6151  6151  is that the computations are very slow, hence mostly of value 
6152  6152  for small cases or instruction. Now we need to use the 
6153  6153  ``orthonormal`` keyword. :: 
… 
… 

6245  6245  Use the ``orthonormal=False`` keyword (or assume it as the default). 
6246  6246  Note that now the orthogonality check creates a diagonal matrix 
6247  6247  whose diagonal entries are the squares of the lengths of the 
6248   vectors. :: 
 6248  vectors. 
6249  6249  
6250  6250  First, in the rationals, without involving ``QQbar``. :: 
6251  6251  
diff r 9bf40613dbca r 1f2f69aed28b sage/modules/misc.py
a

b


64  64  sage: from sage.modules.misc import gram_schmidt 
65  65  sage: V = [vector(ZZ,[1,1]), vector(ZZ,[2,2]), vector(ZZ,[1,2])] 
66  66  sage: gram_schmidt(V) 
 67  Traceback (most recent call last): 
 68  ... 
 69  ValueError: linearly dependent input for module version of GramSchmidt 
67  70  """ 
68  71  import sage.modules.free_module_element 
69  72  if len(B) == 0 or len(B[0]) == 0: 