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
Does OpenSim feature full SimTK Core ?
- Daniel Krueger
- Posts: 24
- Joined: Fri Jul 09, 2010 12:05 am
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Does OpenSim feature full SimTK Core ?
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
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
- Daniel Krueger
- Posts: 24
- Joined: Fri Jul 09, 2010 12:05 am
Re: Does OpenSim feature full SimTK Core ?
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
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
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Does OpenSim feature full SimTK Core ?
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:
You can extract the real part elementwise but should check for complex results unless
you're sure there aren't any.
Sorry the documentation is not better for this!
Regards,
Sherm
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'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();
Regards,
Sherm
- Daniel Krueger
- Posts: 24
- Joined: Fri Jul 09, 2010 12:05 am
Re: Does OpenSim feature full SimTK Core ?
Thank you very much, Sherm!
Complex values really make sense...
Regards,
Daniel
Complex values really make sense...
Regards,
Daniel