これは、私が作ったハウスホルダー変換を用いてQR分解を行うプログラムです。行列の計算を効率良く行うために、LAPACKがあることは知っています。しかし、それらをインストールするのも面倒だなぁっと思ったり、自分のスタイルにあったプログラムの方が使いやすかったりします。そこで、LAPACKよりも計算時間が掛かったり、精度が若干落ちるかもしれませんが、自作のQR分解のプログラムを作って使っています。
This is a program I made to perform QR decomposition using the Householder transform. I know that LAPACK is available to perform matrix calculations efficiently. However, it is troublesome for me to install it, and sometimes it is easier for me to use a programme that suits my style. So, although it might take longer to calculate and be slightly less accurate than LAPACK, I have made my own QR decomposition programme and use it.
Matrix X:
1.000000 2.000000
3.000000 4.000000
5.000000 6.000000
Matrix Q:
-0.169031 0.897085 0.408248
-0.507093 0.276026 -0.816497
-0.845154 -0.345033 0.408248
Matrix R:
-5.916080 -7.437357
0.000000 0.828079
0.000000 0.000000
Matrix Q * R:
1.000000 2.000000
3.000000 4.000000
5.000000 6.000000
# 二乗平均平方根誤差: 3.87254e-016
# root-mean-square error: 3.87254e-016
QR分解を使ってリアプノフスペクトルを推定することが出来ます。また、QR分解を使って最小二乗法を行うことが出来きます。そのことは既に 最小二乗法(正規方程式、逆行列、QR分解)で述べていますが、ここでは上述のQR分解のプログラムを使って、QとRが最小二乗法でどのように使われているかが、よりはっきりと分かるプログラムを掲載します。
QR decomposition can be used to estimate Lyapunov spectra. The QR decomposition can also be used to perform the least squares method. This has already been discussed in least square method (normal equation, inverse matrix and QR decomposition) , but here is a programme that uses the QR decomposition programme described above to more clearly show how Q and R are used in the least square method.
QR分解を用いたリアプノフスペクトルの推定
Lyapunov spectrum estimate using the QR decomposition
QR分解で得られたQとRを使った最小二乗法
least square method using Q and R obtained from the QR decomposition