提升矩阵操作顺序

时间:2013-03-18 15:04:57

标签: c++ visual-studio boost

我重载了加法和乘法运算符。 如果我有这样的程序:

#include <boost/numeric/ublas/matrix.hpp>
typedef boost::numeric::ublas ublas;

int main()
{
   ublas::matrix<double> A(10,10,5);
   double c1 = 10;
   double c2 = 1;

   A = (A*c1) + c2; // something like this wouldn't work.
   // But if i change it to
   A = A*c1;
   A = A+c2;
   // this will work.
   return 0;
}

如何制作A = A*c2+c1;A = (A*c2)+c1

0 个答案:

没有答案