Previous Page Next Page Contents

linalg::orthog -- orthogonalization of vectors

Introduction

linalg::orthog(S) orthogonalizes the vectors in S using the Gram-Schmidt orthogonalization algorithm.

Call(s)

linalg::orthog(S)

Parameters

S - a set or list of vectors of the same dimension (a vector is an n x 1 or 1 x n matrix of a domain of category Cat::Matrix)

Returns

a set or a list of vectors, respectively.

Related Functions

linalg::factorQR, linalg::isUnitary, linalg::normalize, linalg::scalarProduct, lllint, norm

Details

Example 1

The following list of vectors is a basis of the vector space R^3:

>> MatR := Dom::Matrix(Dom::Real):
   S := [MatR([2, 1, 0]), MatR([-3, 1, 1]), MatR([-1, -1, -1])]
                     -- +-   -+  +-    -+  +-    -+ --
                     |  |  2  |  |  -3  |  |  -1  |  |
                     |  |     |  |      |  |      |  |
                     |  |  1  |, |   1  |, |  -1  |  |
                     |  |     |  |      |  |      |  |
                     |  |  0  |  |   1  |  |  -1  |  |
                     -- +-   -+  +-    -+  +-    -+ --

The Gram-Schmidt algorithm then returns an orthogonal basis for R^3. We get an orthonormal basis with the following input:

>> ON := map(linalg::orthog(S), linalg::normalize)
           --               +-        -+  +-              -+ --
           |                |     1/2  |  |     1/2   1/2  |  |
           |  +-        -+  |    6     |  |    8    15     |  |
           |  |     1/2  |  |  - ----  |  |  - ----------  |  |
           |  |  2 5     |  |     6    |  |        60      |  |
           |  |  ------  |  |          |  |                |  |
           |  |    5     |  |    1/2   |  |    1/2   1/2   |  |
           |  |          |  |   6      |  |   8    15      |  |
           |  |    1/2   |, |   ----   |, |   ----------   |  |
           |  |   5      |  |    3     |  |       30       |  |
           |  |   ----   |  |          |  |                |  |
           |  |    5     |  |    1/2   |  |     1/2   1/2  |  |
           |  |          |  |   6      |  |    8    15     |  |
           |  |     0    |  |   ----   |  |  - ----------  |  |
           |  +-        -+  |    6     |  |        12      |  |
           --               +-        -+  +-              -+ --

Example 2

The orthogonalization of the vectors:

>> T := {matrix([[-2, 5, 3]]), matrix([[0, 2, 1]])}
                       { +-       -+  +-        -+ }
                       { | 0, 2, 1 |, | -2, 5, 3 | }
                       { +-       -+  +-        -+ }

gives:

>> linalg::orthog(T)
                 { +-        -+  +-                   -+ }
                 { | -2, 5, 3 |, | 13/19, 11/38, -1/38 | }
                 { +-        -+  +-                   -+ }

Example 3

The result of linalg::orthog is a list or set of linearly independent vectors, even if the input contains linearly dependent vectors:

>> MatQ := Dom::Matrix(Dom::Rational):
   S := [MatQ([2, 1]), MatQ([3, 4]), MatQ([-1, 1])]
                     -- +-   -+  +-   -+  +-    -+ --
                     |  |  2  |  |  3  |  |  -1  |  |
                     |  |     |, |     |, |      |  |
                     |  |  1  |  |  4  |  |   1  |  |
                     -- +-   -+  +-   -+  +-    -+ --
>> linalg::orthog(S)
                          -- +-   -+  +-    -+ --
                          |  |  2  |  |  -1  |  |
                          |  |     |, |      |  |
                          |  |  1  |  |   2  |  |
                          -- +-   -+  +-    -+ --

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000