0

I get an error like CXX0059: Error: left operand is class not a function name in VS2010, when i try to watch the values in columns and rows of my Jacobian Matrix.

For example; i have a matrix like

MatrixXf j = MatrixXf::Zero(2,mList.size());
...
...
   for(...)
   {
     j(0, col) += (-mList[i]->mLength*sin(angle));
     j(1, col) += ( mList[i]->mLength*cos(angle));
   }

and when i debugging this part, it fails to watch the variable j(0,col). I know, maybe it's not a function name, but it has some value in it. I mean, the matrix consists of 10 cells, but what i get from visual studio is only one float value.

Here is the sc of debug:

debug screen

Appreciate any help on watching the value of each cell.

Bedir Yilmaz
  • 3,823
  • 5
  • 34
  • 54

1 Answers1

1

The j(0, col) construction calls overloaded operator()() on the class MatrixXf, such constructions are not evaluated by the debugger in native code. To view matrix's content, you should locate a pointer to the data inside the instance of MatrixXf. Most likely, it will have a float* type pointing to an array of data. By default, it is displayed in the debugger as a single float value. But you can specify its size manually as described here to expand an array, like this: j.ptr,10.

You can further enhance this approach by writing a special display rule in the autoexp.dat file. See a comprehensive tutorial here.

Community
  • 1
  • 1
Mikhail
  • 20,685
  • 7
  • 70
  • 146