Does OpenSim feature full SimTK Core ?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Daniel Krueger
Posts: 24
Joined: Fri Jul 09, 2010 12:05 am

Does OpenSim feature full SimTK Core ?

Post by Daniel Krueger » Sun Feb 03, 2013 1:33 am

Hello,
i have the following problem: within an OpenSim API programm I need to make use of some SimTK linear algebra functions. more precisely I want to compute eigenvalues using SimTK::Eigen class. However as soon as I try to call any methods of this class, I get a link error that says: "unresolved symbol"
I was wandering if the OpenSim sdk libs feature all classes of simtk?
Best regards, Daniel

User avatar
Michael Sherman
Posts: 812
Joined: Fri Apr 01, 2005 6:05 pm

Re: Does OpenSim feature full SimTK Core ?

Post by Michael Sherman » Sun Feb 03, 2013 1:46 pm

Hi, Daniel.

Yes, OpenSim's API provides full access to everything in the SimTK namespace, including SimTK::Eigen. However, the methods of the Eigen class are templatized, with only certain combinations of template arguments corresponding to available implementations. Any combination that isn't available will produce an "unresolved symbol" link error.

Please post more specific information about precisely what you are trying to do, the code you used to do it, and the exact error message you received. Then I can help you get it to work.

Regards,
Sherm

User avatar
Daniel Krueger
Posts: 24
Joined: Fri Jul 09, 2010 12:05 am

Re: Does OpenSim feature full SimTK Core ?

Post by Daniel Krueger » Mon Feb 04, 2013 12:25 am

Hi Sherm,
thanks for your reply.
Here is my code:
Matrix H; //matrix of elt <double>

//..init matrix H to something

Vector d; //also double
Matrix V; //also double

Eigen e(H);
e.getAllEigenValuesAndVectors(d,V); //compute Eigenvalues and -vectors

When I try to link this code the following error appears:
error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: void __thiscall SimTK::Eigen::getAllEigenValuesAndVectors<double,double>(class SimTK::Vector_<double> &,class SimTK::Matrix_<double> &)"


"Verweis auf nicht aufgelöstes externes Symbol" = "reference to unresolved external symbol" (german vc++)

This is strange because apparently there is an implementation of .getAllEigenValuesAndVectors for objects of data type <double>.

Thank you for your help!
Daniel

User avatar
Michael Sherman
Posts: 812
Joined: Fri Apr 01, 2005 6:05 pm

Re: Does OpenSim feature full SimTK Core ?

Post by Michael Sherman » Mon Feb 04, 2013 11:06 am

Hi, Daniel.

The problem is that eigenvalues and eigenvectors of a general real matrix can be complex. So we didn't implement the method with just real arguments. You can easily use complex arguments:

Code: Select all

Matrix H; // real
// SimTK::Complex is just a typedef to std::complex<double> which you can use instead
// if you prefer.
Vector<Complex> d; // eigenvalues may be complex
Matrix<Complex> V; // same for eigenvectors
Eigen e(H);
e.getAllEigenValuesAndVectors(d,V);
You can extract the real part elementwise but should check for complex results unless 
you're sure there aren't any.

Code: Select all

Vector d_real(d.size());
for (int i=0; i < d.size(); ++i)
   d_real[i] = d[i].real(); 
 
Sorry the documentation is not better for this!

Regards,
Sherm

User avatar
Daniel Krueger
Posts: 24
Joined: Fri Jul 09, 2010 12:05 am

Re: Does OpenSim feature full SimTK Core ?

Post by Daniel Krueger » Tue Feb 05, 2013 12:52 am

Thank you very much, Sherm!
Complex values really make sense...
Regards,
Daniel

POST REPLY