# 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
|
b
|
cdef class Matrix(matrix1.Matrix): |
2973 | 2973 | """ |
2974 | 2974 | return self.__invert__() |
2975 | 2975 | |
2976 | | def gramm_schmidt(self): |
| 2976 | def gram_schmidt(self): |
2977 | 2977 | r""" |
2978 | 2978 | Return the matrix G whose rows are obtained from the rows of self (=A) by |
2979 | | applying the Gramm-Schmidt orthogonalization process. Also return |
| 2979 | applying the Gram-Schmidt orthogonalization process. Also return |
2980 | 2980 | the coefficients mu ij, i.e., a matrix mu such that \code{(mu + 1)*G == A}. |
2981 | 2981 | |
2982 | 2982 | OUTPUT: |
… |
… |
cdef class Matrix(matrix1.Matrix): |
2989 | 2989 | [ -1 2 5] |
2990 | 2990 | [-11 1 1] |
2991 | 2991 | [ 1 -1 -3] |
2992 | | sage: G, mu = A.gramm_schmidt() |
| 2992 | sage: G, mu = A.gram_schmidt() |
2993 | 2993 | sage: G |
2994 | 2994 | [ -1 2 5] |
2995 | 2995 | [ -52/5 -1/5 -2] |
… |
… |
cdef class Matrix(matrix1.Matrix): |
3009 | 3009 | sage: (mu + 1)*G == A |
3010 | 3010 | True |
3011 | 3011 | """ |
3012 | | from sage.modules.misc import gramm_schmidt |
| 3012 | from sage.modules.misc import gram_schmidt |
3013 | 3013 | from constructor import matrix |
3014 | | Bstar, mu = gramm_schmidt(self.rows()) |
| 3014 | Bstar, mu = gram_schmidt(self.rows()) |
3015 | 3015 | return matrix(Bstar), mu |
3016 | 3016 | |
3017 | 3017 | |
diff -r 1e63b45b9dca -r 6f44051873a8 sage/modules/misc.py
a
|
b
|
AUTHORS: |
14 | 14 | |
15 | 15 | from sage.matrix.constructor import matrix |
16 | 16 | |
17 | | def gramm_schmidt(B): |
| 17 | def gram_schmidt(B): |
18 | 18 | """ |
19 | | Return the Gramm-Schmidt orthogonalization of the entries in the list |
20 | | B of vectors, along with the matrix mu of Gramm-Schmidt coefficients. |
| 19 | Return the Gram-Schmidt orthogonalization of the entries in the list |
| 20 | B of vectors, along with the matrix mu of Gram-Schmidt coefficients. |
21 | 21 | |
22 | 22 | Note that the output vectors need not have unit length. We do this |
23 | 23 | to avoid having to extract square roots. |
24 | 24 | |
25 | 25 | EXAMPLES: |
26 | 26 | sage: B = [vector([1,2,1/5]), vector([1,2,3]), vector([-1,0,0])] |
27 | | sage: from sage.modules.misc import gramm_schmidt |
28 | | sage: G, mu = gramm_schmidt(B) |
| 27 | sage: from sage.modules.misc import gram_schmidt |
| 28 | sage: G, mu = gram_schmidt(B) |
29 | 29 | sage: G |
30 | 30 | [(1, 2, 1/5), (-1/9, -2/9, 25/9), (-4/5, 2/5, 0)] |
31 | 31 | sage: G[0] * G[1] |