Changeset 7483:2b5f5af88709


Ignore:
Timestamp:
11/18/07 19:34:36 (6 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Message:

trac #1201 gramm-schmidt

Location:
sage
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • sage/matrix/matrix2.pyx

    r7334 r7483  
    29682968        return self.__invert__() 
    29692969 
     2970    def gramm_schmidt(self): 
     2971        r""" 
     2972        Return the matrix G whose rows are obtained from the rows of self (=A) by 
     2973        applying the Gramm-Schmidt orthogonalization process.  Also return 
     2974        the coefficients mu ij, i.e., a matrix mu such that \code{(mu + 1)*G == A}. 
     2975 
     2976        OUTPUT: 
     2977            G -- a matrix whose rows are orthogonal 
     2978            mu -- a matrix that gives the transformation, via the relation 
     2979                  (mu + 1)*G == self 
     2980         
     2981        EXAMPLES: 
     2982            sage: A = matrix(ZZ, 3, [-1, 2, 5, -11, 1, 1, 1, -1, -3]); A 
     2983            [ -1   2   5] 
     2984            [-11   1   1] 
     2985            [  1  -1  -3] 
     2986            sage: G, mu = A.gramm_schmidt() 
     2987            sage: G 
     2988            [     -1       2       5] 
     2989            [  -52/5    -1/5      -2] 
     2990            [  2/187  36/187 -14/187] 
     2991            sage: mu 
     2992            [     0      0      0] 
     2993            [   3/5      0      0] 
     2994            [  -3/5 -7/187      0] 
     2995            sage: G[0] * G[1] 
     2996            0 
     2997            sage: G[0] * G[2] 
     2998            0 
     2999            sage: G[1] * G[2] 
     3000            0 
     3001 
     3002        The relation between mu and A is as follows: 
     3003            sage: (mu + 1)*G == A 
     3004            True 
     3005        """         
     3006        from sage.modules.misc import gramm_schmidt 
     3007        from constructor import matrix 
     3008        Bstar, mu = gramm_schmidt(self.rows()) 
     3009        return matrix(Bstar), mu 
     3010 
    29703011     
    29713012def _dim_cmp(x,y): 
Note: See TracChangeset for help on using the changeset viewer.