mercredi 29 juillet 2015

cannot convert 'const ScalarMultipleReturnType Error

Running my code gives the following compilation error:

cannot convert 'const ScalarMultipleReturnType {aka const Eigen::CwiseUnaryOp, const Eigen::Matrix >}' to 'double' in initialization double tempSum = deltaT*(vectorB(i)-vectorB2(i))*k[i];

at the following line:

double tempSum = deltaT*(vectorB(i)-vectorB2(i))*k[i];
truncError = truncError + tempSum;

I have defined variables vectorB and vectorB2 as: Eigen::VectorXd vectorB; and initialized as vectorB = Eigen::VectorXd::Zero(size); for both vectors respectively.

k is defined as: std::vector<Eigen::MatrixXd> k(size);

deltaT is of type double

Each Even though k is a vector of Matrices, each matrix has only one value. eg: k[0] is a single double value.

Can someone please help me with the type conversion here? I think that's what's causing the issue. I wish to convert the RHS of the expression double tempSum = deltaT*(vectorB(i)-vectorB2(i))*k[i] into a double variable.

Aucun commentaire:

Enregistrer un commentaire