wscott@EN.ECN.PURDUE.EDU (Wayne H Scott) (03/14/90)
Posted for a friend:
From: Philip Peleties dominop@ec.ecn.purdue.edu
Gram-Schmidt Process for finding orthonormal basis of
finite-dimensional vector spaces.
Objective: Compute an orthonormal basis of a finite-dimensional
real vector space V.
Method: Motified Gram-Schmidt process on a basis of V (see pp.
141, "Applied Linear Algebra", Second Edition, 1977, by Ben
Noble, James W. Daniel, Prentice-Hall, Inc., Englewood
Cliffs, NJ 07632.
Input: a) A set of vectors representing a basis of V.
b) The number of vectors.
Output: An set of vectors comprising an orthonormal basis of V.
Notes: An example of a possible input looks like:
3: [ 1 1 ]
2: [ 1 -1 ]
1: 2
then the output looks like:
2: [ .707106781188 .707106781188]
1: [ .707106781188 -.707106781188]
Bugs: If the dot product is zero you get an error (!).
If the basis is complex, then the resulting vectors
are orthogonal but not orthonormal. I'll try to fix
it one of these days ...
-----------------------------------------------------------------------
<< -> s
<< 1 s
FOR j DUP DUP
DOT sqrt /
IF 2 s j - 1 +
<=
THEN 2 s j - 1
+
FOR i DUP i
1 + ROLL SWAP DUP2
DOT * - i ROLLD
NEXT
END s ROLLD
NEXT
>>
>>
---------------------------------------------------------------------
Philip Peleties dominop@ec.ecn.purdue.edu
_______________________________________________________________________________
Wayne Scott | INTERNET: wscott@en.ecn.purdue.edu
Electrical Engineering | BITNET: wscott%ea.ecn.purdue.edu@purccvm
Purdue University | UUCP: {purdue, pur-ee}!en.ecn.purdue.edu!wscott