我已经重载了加法和乘法运算符。如果我有这样的程序:
#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
工作?