# Ticket #1794: 8014.patch

File 8014.patch, 2.7 KB (added by wjp, 14 years ago)
• ## sage/matrix/matrix2.pyx

```# HG changeset patch
# User Willem Jan Palenstijn <wpalenst@math.leidenuniv.nl>
# Date 1200505917 -3600
# Node ID 6f44051873a8dafd1fb829edf30ff3da4b552e38
# Parent  1e63b45b9dca6743a1f14ce6b2f02f72111859b3
Gramm-Schmidt -> Gram-Schmidt

diff -r 1e63b45b9dca -r 6f44051873a8 sage/matrix/matrix2.pyx```
 a cdef class Matrix(matrix1.Matrix): """ return self.__invert__() def gramm_schmidt(self): def gram_schmidt(self): r""" Return the matrix G whose rows are obtained from the rows of self (=A) by applying the Gramm-Schmidt orthogonalization process.  Also return applying the Gram-Schmidt orthogonalization process.  Also return the coefficients mu ij, i.e., a matrix mu such that \code{(mu + 1)*G == A}. OUTPUT: cdef class Matrix(matrix1.Matrix): [ -1   2   5] [-11   1   1] [  1  -1  -3] sage: G, mu = A.gramm_schmidt() sage: G, mu = A.gram_schmidt() sage: G [     -1       2       5] [  -52/5    -1/5      -2] cdef class Matrix(matrix1.Matrix): sage: (mu + 1)*G == A True """ from sage.modules.misc import gramm_schmidt from sage.modules.misc import gram_schmidt from constructor import matrix Bstar, mu = gramm_schmidt(self.rows()) Bstar, mu = gram_schmidt(self.rows()) return matrix(Bstar), mu
• ## sage/modules/misc.py

`diff -r 1e63b45b9dca -r 6f44051873a8 sage/modules/misc.py`
 a AUTHORS: from sage.matrix.constructor import matrix def gramm_schmidt(B): def gram_schmidt(B): """ Return the Gramm-Schmidt orthogonalization of the entries in the list B of vectors, along with the matrix mu of Gramm-Schmidt coefficients. Return the Gram-Schmidt orthogonalization of the entries in the list B of vectors, along with the matrix mu of Gram-Schmidt coefficients. Note that the output vectors need not have unit length. We do this to avoid having to extract square roots. EXAMPLES: sage: B = [vector([1,2,1/5]), vector([1,2,3]), vector([-1,0,0])] sage: from sage.modules.misc import gramm_schmidt sage: G, mu = gramm_schmidt(B) sage: from sage.modules.misc import gram_schmidt sage: G, mu = gram_schmidt(B) sage: G [(1, 2, 1/5), (-1/9, -2/9, 25/9), (-4/5, 2/5, 0)] sage: G[0] * G[1]