私はMtx
それが行列間のいくつかの計算を行います
Mtx M1(rows1,cols1,1); //instantiate data members and fill the matrix with 1s
Mtx M2(rows2,cols2,2); //instantiate data members and fill the matrix with 2s
Mtx M3(rows3,cols3,0); //instantiate data members and fill the matrix with 0s
M3 += M1; //+= is overloaded - First M3
M3 -= M2; //-= is overloaded - Second M3
ゼロで埋められた最初のM3
テイクに追加すると、答えは に割り当てられます。ここでは問題ありません。M3
M1
M3
問題は2番目M3
です!ゼロで埋められたものを減算M3
するのではなく、前の演算の結果を使用して から減算しM2
ます。
M3
値を保持する静的にするにはどうすればよいですか? 静的オブジェクトに関連するものですか?あなたが私の主張を理解してくれることを願っています!
あなたの助けに感謝します...