Description
1. Write a program to implement the following Gram-Schmidt Orthogonalization Procedure
Input : A set of r linearly independent vectors {
#»x1,
#»x2, . . . ,
#»xr}
Output: A set of r orthonormal vectors {
#»q 1,
#»q 2, . . . ,
#»q r} such that
Span ({
#»xi}
r
i=1) = Span ({
#»q i}
r
i=1)
1 r11 ← k#»x1k;
2 if r11 = 0 then
3 Stop
4 else
5
#»q 1 ← x1
r11
6 end
7 for j ← 2 to r do
8 for i ← 1 to j − 1 do
9 rij ← (
#»xj ,
#»q i);
10 end
11 qˆ ← #»xj −
Pj−1
i=1 rij
#»q i
;
12 rjj ← kqˆk;
13 if rjj = 0 then
14 Stop;
15 else
16 #»q j ← qˆ
rjj
;
17 end
18 end
Algorithm 1: Gram-Schmidt Orthogonalization Procedure
Page 1 of 2
2. Write a program to implement the following Modified Gram-Schmidt Orthogonalization
Procedure
Input : A set of r linearly independent vectors {
#»x1,
#»x2, . . . ,
#»xr}
Output: A set of r orthonormal vectors {
#»q 1,
#»q 2, . . . ,
#»q r} such that
Span ({
#»xi}
r
i=1) = Span ({
#»q i}
r
i=1)
1 r11 ← k#»x1k;
2 if r11 = 0 then
3 Stop
4 else
5
#»q 1 ← x1
r11
6 end
7 for j ← 2 to r do
8 qˆ ← #»xj ;
9 for i ← 1 to j − 1 do
10 rij = (ˆq, #»q i);
11 qˆ = ˆq −
Pj−1
i=1 rij
#»q i
;
12 end
13 rjj ← kqˆk;
14 if rjj = 0 then
15 Stop;
16 else
17 #»q j =
qˆ
rjj
;
18 end
19 end
Algorithm 2: Modified Gram-Schmidt Orthogonalization Procedure
Page 2 of 2