Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved Compilation error when using float #123

Merged
merged 1 commit into from
Aug 2, 2022
Merged

Resolved Compilation error when using float #123

merged 1 commit into from
Aug 2, 2022

Conversation

voldien
Copy link
Contributor

@voldien voldien commented Jul 20, 2022

Resolves compilation error when c_float is set to float.

@voldien voldien changed the title Resolved Compilation using float Resolved Compilation error when using float Jul 20, 2022
@GiulioRomualdi
Copy link
Member

Hi @voldien thank you for your contribution! We really appreciate it. I will try review the PR before the end of this week

@GiulioRomualdi GiulioRomualdi self-requested a review July 20, 2022 10:23
@wxmerkt
Copy link
Contributor

wxmerkt commented Jul 20, 2022

This change will break compilation with double. Templating might be a solution, however I believe that casting in user-applications is the correct approach. @voldien, can you try ....getSolution().cast<c_float>() in your application without changing the osqp-eigen? Would this resolve your issues?

@voldien
Copy link
Contributor Author

voldien commented Jul 20, 2022

The compilation error is caused by changing the c_float inside osqp to float instead of double. Since i trying to increase performance for my application.

So the compilation error is not on my not on my side, since then I would just cast it as you mention. rather the compilation error is inside both OsqpEigen::Solver::getDualSolution() and OsqpEigen::Solver::getSolution(). Since it tries to pass a float pointer to VectorXd.

I thought the reason for it being a double for these two methods was just a miss, since the rest of variables and methods in the class are using the c_float.

@wxmerkt
Copy link
Contributor

wxmerkt commented Jul 20, 2022

Right, I missed this - you're correct

@GiulioRomualdi
Copy link
Member

Thank you very much @voldien! Merging!

@GiulioRomualdi GiulioRomualdi merged commit 294671d into robotology:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants