Ticket #10791: trac-10791-gram-schmidt-doctests-v2.patch

File trac-10791-gram-schmidt-doctests-v2.patch, 2.6 KB (added by mraum, 10 years ago)

A copy of trac_10791-gram-schmidt-doctests-v2.patch

  • sage/matrix/matrix2.pyx

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1301203798 25200
    # Node ID 1f2f69aed28b5eac302b6bcf790b3948a4e34b3a
    # Parent  9bf40613dbca3acfc33762f3c01774df48f4f9f4
    10791: doctest edits for Gram-Schmidt routines
    diff -r 9bf40613dbca -r 1f2f69aed28b sage/matrix/matrix2.pyx
    a b  
    60666066        to arrive at an orthonormal set, it must be possible to construct
    60676067        square roots of the elements of the base field.  In Sage, your
    60686068        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.
    60716071        If you have an approximate numerical matrix, then this routine
    60726072        requires that your base field be the real and complex
    60756075        attempt is made to recognize linear dependence with approximate
    60766076        calculations.
    6078         EXAMPLES::
     6078        EXAMPLES:
    60806080        Inexact Rings, Numerical Matrices:
    61476147        To scale a vector to unit length requires taking
    61486148        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
    61516151        is that the computations are very slow, hence mostly of value
    61526152        for small cases or instruction. Now we need to use the
    61536153        ``orthonormal`` keyword.  ::
    62456245        Use the ``orthonormal=False`` keyword (or assume it as the default).
    62466246        Note that now the orthogonality check creates a diagonal matrix
    62476247        whose diagonal entries are the squares of the lengths of the
    6248         vectors. ::
     6248        vectors.
    62506250        First, in the rationals, without involving ``QQbar``.  ::
  • sage/modules/misc.py

    diff -r 9bf40613dbca -r 1f2f69aed28b sage/modules/misc.py
    a b  
    6464        sage: from sage.modules.misc import gram_schmidt
    6565        sage: V = [vector(ZZ,[1,1]), vector(ZZ,[2,2]), vector(ZZ,[1,2])]
    6666        sage: gram_schmidt(V)
     67        Traceback (most recent call last):
     68        ...
     69        ValueError: linearly dependent input for module version of Gram-Schmidt
    6770    """
    6871    import sage.modules.free_module_element
    6972    if len(B) == 0 or len(B[0]) == 0: