This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Error in writing to a mapped array?

Tags: None
(comma "," separated)
coolcat
Registered Member
Posts
20
Karma
0
OS

Error in writing to a mapped array?

Thu Dec 06, 2012 2:19 am
What caused the following error in the code below ?
Thanks in advance .

[In Visual Studio 2010]
const EIgen::Matrix<double, 6, 1> &F
Error: no suitable user-defined conversion from "const Eigen::Matrix<double, 6, 1, 0, 6, 1>" to "Eigen::Map<Eigen::Matrix<double, 6, 1, 0, 6, 1>, 0, Eigen::Stride<0, 0>>" exists

-----------------------------------------------------------
// inside a class definition
inline virtual void compute(EIgen::Matrix<double, 6, 1> const & F, double * const torque) const
{
Eigen::Map<Eigen::Matrix<double, 6, 1>>(torque) = _E.transpose()*F;
}

-----------------------------------------------------------
jitseniesen
Registered Member
Posts
204
Karma
2
I think that the statement is parsed as a declaration of a variable with the name torque. I did not try with Visual Studio, but that is what gcc appears to do. Possible solutions may be to split the statement in two, as in:

Eigen::Map<Eigen::Matrix<double, 6, 1> > torqueMap(torque);
torqueMap = _E.transpose()*F;

or add some parentheses so that it cannot be parsed as a declaration:

(Eigen::Map<Eigen::Matrix<double, 6, 1> >(torque)) = _E.transpose()*F;
coolcat
Registered Member
Posts
20
Karma
0
OS
Thanks.
Your suggestion works.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]