-
Notifications
You must be signed in to change notification settings - Fork 120
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
Ownership of bounds, gradient, Hessian, and constraint matrix #16
Comments
Hi @joaospinto thanks for using
The library wants to be a simple wrapper to osqp-eigen/include/OsqpEigen/Data.tpp Line 35 in 7109a22
and here the memory is allocated and the Hessian matrix is copied osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp Lines 34 to 53 in 7109a22
This is required by osqp itself. Indeed osqp wants a pointer to a csc struct when the first optimization problem is created.
On the other hand, when you set the gradient no memory allocation is performed and a pointer to the vector is passed to the osqp-eigen/include/OsqpEigen/Data.tpp Lines 44 to 55 in 7109a22
So in simple terms:
On the light of this, it would be nice to have a simple example where I can try to replicate your problem. |
@GiulioRomualdi That makes sense. I actually only had issues with the bound vectors; I somehow assumed that the same issue would exist with the matrices, so I made sure they would not go out of scope as well, but had not double checked. Thanks for clarifying! Also, thanks for writing this library, you probably saved me a couple of days of work. |
When writing a class that encapsulates the use of this library in my codebase, I noticed that I had to store all matrices/vectors as private variables, otherwise some of the pointers would become stale (your library does not seem to be taking ownership of those matrices/vectors). Is this intended? Took me a while to figure this out.
Also, the way you pass
Eigen
objects around seems a bit unorthodox. You may want to read this.The text was updated successfully, but these errors were encountered: