Sunday, 12 January 2014

Gram-Schmidt orthogonalization

The Gram-Schmidt process is used to find a set of orthogonal vectors from a general set of vectors.

Suppose we have a set of nonorthogonal vectors v0...vn-1 and from them we want to create the orthogonal set w0...wn-1. (n is the dimension.) We can simply use the first vector from the nonorthogonal set as the starting vector for the new set: w0.

The next vector can be obtained by projecting v1 on w0, and then subtracting the projection from v1: w1 = v1 - projw0v1 = v1 - ( v1 . w0 / ||w0||2 ) (w0).

The rough idea should be clear by now. For w2, w2 = v2 - projw0v2 - projw1v2. The same process is repeated for the remaining vectors: wi = vi - sigmai-1j=0(projwjvi). Thus, we are able to obtain the set of orthogonal vectors from the general set of vectors.

To get an orthonormal set instead, either perform the normalization at the end, or normalize each w as we go along.

No comments:

Post a Comment