行列:TMatrix応用 固有値、固有ベクトル、転置行列
{
gROOT->Reset();
TMatrixD m, n, p, q;
m.ResizeTo(3,3,-1);
n.ResizeTo(3,3,-1);
p.ResizeTo(3,3,-1);
q.ResizeTo(3,3,-1);
m[0][0] = 1.0; m[0][1] = 2.0; m[0][2] = 3.0;
m[1][0] = 4.0; m[1][1] = 8.0; m[1][2] = 6.0;
m[2][0] = 7.0; m[2][1] = 8.0; m[2][2] = 9.0;
TMatrixDEigen *x = new TMatrixDEigen(m);
n += x->GetEigenVectors();//固有ベクトル
p += x->GetEigenValues();//固有値
m.Print();//それぞれ出力
n.Print();
p.Print();
q += m.T();//転置行列、呼ばれるとm自身も転置
q.Print();
m.Print();
}
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 1 2 3
1 | 4 8 8
2 | 7 6 9
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | -0.2246 0.275 0.8101
1 | -0.6195 -0.769 0.03001
2 | -0.7981 0.5965 -0.5855
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 17.18 0 0
1 | 0 1.915 0
2 | 0 0 -1.094
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 1 4 7
1 | 2 8 8
2 | 3 6 9
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 1 4 7
1 | 2 8 8
2 | 3 6 9
gROOT->Reset();
TMatrixD m, n, p, q;
m.ResizeTo(3,3,-1);
n.ResizeTo(3,3,-1);
p.ResizeTo(3,3,-1);
q.ResizeTo(3,3,-1);
m[0][0] = 1.0; m[0][1] = 2.0; m[0][2] = 3.0;
m[1][0] = 4.0; m[1][1] = 8.0; m[1][2] = 6.0;
m[2][0] = 7.0; m[2][1] = 8.0; m[2][2] = 9.0;
TMatrixDEigen *x = new TMatrixDEigen(m);
n += x->GetEigenVectors();//固有ベクトル
p += x->GetEigenValues();//固有値
m.Print();//それぞれ出力
n.Print();
p.Print();
q += m.T();//転置行列、呼ばれるとm自身も転置
q.Print();
m.Print();
}
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 1 2 3
1 | 4 8 8
2 | 7 6 9
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | -0.2246 0.275 0.8101
1 | -0.6195 -0.769 0.03001
2 | -0.7981 0.5965 -0.5855
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 17.18 0 0
1 | 0 1.915 0
2 | 0 0 -1.094
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 1 4 7
1 | 2 8 8
2 | 3 6 9
3x3 matrix is as follows
| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 1 4 7
1 | 2 8 8
2 | 3 6 9
0 Comments:
コメントを投稿
<< Home