グラム・シュミットの正規直交化法
Gram–Schmidt orthonormalisation

# org u

1.000000   2.000000   1.000000

-1.000000   -1.000000   -1.000000

0.000000   -2.000000   -2.000000


column 0: u0

    1.000000

    -1.000000

    0.000000

column 1: u1

    2.000000

    -1.000000

    -2.000000

column 2: u2

    1.000000

    -1.000000

    -2.000000

#-------------------------------------------

# orthonormalised u = e/|e|

 0.707107   0.235702   -0.666667

 -0.707107   0.235702   -0.666667

 0.000000   -0.942809   -0.333333

#-------------------------------------------

# orthogonalised matrix e (not normalised)

 1.000000   0.500000   -0.444444

 -1.000000   0.500000   -0.444444

 0.000000   -2.000000   -0.222222

#-------------------------------------------

# u =  e/|e|

column 0: e0/|e0|

 |e0|: 1.414214

    1.000000/1.414214 = 0.707107

    -1.000000/1.414214 = -0.707107

    0.000000/1.414214 = 0.000000


column 1: e1/|e1|

 |e1|: 2.121320

    0.500000/2.121320 = 0.235702

    0.500000/2.121320 = 0.235702

    -2.000000/2.121320 = -0.942809


column 2: e2/|e2|

 |e2|: 0.666667

    -0.444444/0.666667 = -0.666667

    -0.444444/0.666667 = -0.666667

    -0.222222/0.666667 = -0.333333


#-------------------------------------------

# transposed matrix uT of u

 0.707107   -0.707107   0.000000

 0.235702   0.235702   -0.942809

 -0.666667   -0.666667   -0.333333

#-------------------------------------------

# check uT * u = unit matrix

 1.000000   0.000000   0.000000

 0.000000   1.000000   -0.000000

 0.000000   -0.000000   1.000000

#-------------------------------------------

# L2 norm of each column of orthonormalised u 

column 0: 1.000000

column 1: 1.000000

column 2: 1.000000

#-------------------------------------------

# product of two columns of u

column 0 * column 1: 0.000000

column 0 * column 2: 0.000000

column 1 * column 2: -0.000000

programme

makefile

main.h

main.c 

gram_schmidt_orth.c


main.c contains the main function.