Ticket #10795: trac_10795-QR-decomposition-formatting.patch

File trac_10795-QR-decomposition-formatting.patch, 3.9 KB (added by rbeezer, 9 years ago)
  • sage/matrix/matrix_double_dense.pyx

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1338221564 25200
    # Node ID ffdac398bcc48fad6e69ed78053a7a84fdd9e04c
    # Parent  14681b4611ebe43d4bc7476d5ec26fe1256ad6bd
    QR decomposition documentation formatting
    
    diff --git a/sage/matrix/matrix_double_dense.pyx b/sage/matrix/matrix_double_dense.pyx
    a b  
    22252225
    22262226        OUTPUT:
    22272227
    2228         `Q`, `R` -- a pair of matrices such that `A = QR` such that
    2229         the columns of Q are orthogonal (i.e., `Q^\ast Q = I`),
    2230         and R is upper triangular, where `Q^\ast` is the
    2231         conjugate-transpose in the complex case and the transpose
    2232         in the real case. If `A` is an `m\times n` matrix and
    2233         ``full=True`` then this method returns a pair of matrices:
    2234         `Q` is an `m\times m` unitary matrix (meaning its inverse
    2235         is its conjugate-transpose) and `R` is an `m\times n`
    2236         upper-triangular matrix.  For a matrix of full rank this
    2237         factorization is unique up to the sign of the diagonal entries.
     2228        ``Q``, ``R`` -- a pair of matrices such that if `A`
     2229        is the original matrix, then
     2230
     2231        .. math::
     2232
     2233          A = QR, \quad Q^\ast Q = I
     2234
     2235        where `R` is upper-triangular.  `Q^\ast` is the
     2236        conjugate-transpose in the complex case, and just
     2237        the transpose in the real case. So `Q` is a unitary
     2238        matrix (or rather, orthogonal, in the real case),
     2239        or equivalently `Q` has orthogonal columns.  For a
     2240        matrix of full rank this factorization is unique
     2241        up to adjustments via multiples of rows and columns
     2242        by multiples with scalars having modulus `1`.  So
     2243        in the full-rank case, `R` is unique if the diagonal
     2244        entries are required to be positive real numbers.
    22382245
    22392246        The resulting decomposition is cached.
    22402247
     
    22452252
    22462253        EXAMPLES:
    22472254
    2248         Over the reals, the inverse of `Q` is its transpose,
     2255        Over the reals, the inverse of ``Q`` is its transpose,
    22492256        since including a conjugate has no effect.  In the real
    2250         case, we say `Q` is orthogonal. ::
     2257        case, we say ``Q`` is orthogonal. ::
    22512258
    22522259            sage: A = matrix(RDF, [[-2, 0, -4, -1, -1],
    22532260            ...                    [-2, 1, -6, -3, -1],
     
    22812288            [0.0 0.0 0.0 0.0 0.0]
    22822289
    22832290        Now over the complex numbers, demonstrating that the SciPy libraries
    2284         are (properly) using the Hermitian inner product, so that `Q` is
     2291        are (properly) using the Hermitian inner product, so that ``Q`` is
    22852292        a unitary matrix (its inverse is the conjugate-transpose).  ::
    22862293
    22872294            sage: A = matrix(CDF, [[-8, 4*I + 1, -I + 2, 2*I + 1],
     
    23132320        An example of a rectangular matrix that is also rank-deficient.
    23142321        If you run this example yourself, you may see a very small, nonzero
    23152322        entries in the third row, in the third column, even though the exact
    2316         version of the matrix has rank 2.  The final two columns of ``Q`` span the left kernel of ``A`` and different platforms will compute different
    2317         bases so we do not exhibit the actual matrix.  ::
     2323        version of the matrix has rank 2.  The final two columns of ``Q``
     2324        span the left kernel of ``A`` (as evidenced by the two zero rows of
     2325        ``R``).  Different platforms will compute different bases for this
     2326        left kernel, so we do not exhibit the actual matrix.  ::
    23182327
    23192328            sage: Arat = matrix(QQ, [[2, -3, 3],
    23202329            ...                      [-1, 1, -1],
     
    23562365        TESTS:
    23572366
    23582367        Trivial cases return trivial results of the correct size,
    2359         and we check `Q` itself in one case, verifying a fix for
     2368        and we check ``Q`` itself in one case, verifying a fix for
    23602369        :trac:`10795`.  ::
    23612370
    23622371            sage: A = zero_matrix(RDF, 0, 10)