ROOTStudy

木曜日, 12月 14, 2006

Operator: 行列の積 = "*="

{
gROOT->Reset();


TMatrixD m, n;

m.ResizeTo(3,3,-1);
n.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;

m.Print();

n += m;
n *= m.T();//T()呼び出しでm自身も転置されることに注意

m.Print();
n.Print();
}

実行結果


3x3 matrix is as follows

| 0 | 1 | 2 |
------------------------------------------------------------------
0 | 1 2 3
1 | 4 8 6
2 | 7 8 9


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 | 14 38 50
1 | 38 116 146
2 | 50 146 194

1 Comments:

  • At 8:58 午前, Anonymous 匿名 said…

    Hi this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I'm starting a blog soon but have no coding experience so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

    Feel free to visit my web-site; michael kors sale

     

コメントを投稿

<< Home