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

Should P be upper triangular #124

Closed
govindchari opened this issue Jul 25, 2023 · 3 comments
Closed

Should P be upper triangular #124

govindchari opened this issue Jul 25, 2023 · 3 comments

Comments

@govindchari
Copy link

I am solving a problem using both the C interface and OSQP.jl.

In the C interface I only pass in the upper triangular portion of P as required.

The only way I can get my C solution and OSQP.jl solution to match is if I only pass in the upper triangular part of P into OSQP.jl.

This is contradictory to how some of the tests in the test directory are written (specifically primal_infeasibility.jl where an arbitrary symmetric matrix is passed in as opposed to just the upper triangular portion.

What is the correct way to pass P into OSQP.jl? If only the upper triangular part needs to be passed it would be good to call this out in the documentation.

@imciner2
Copy link
Member

What is the structure of P you are using? There is code to take a matrix an get the upper triangular component if it isn't already upper triangular, but there is a bug in it: #93.

@govindchari
Copy link
Author

Ah I see. It turns out that I messed up something in my end. I had an upper triangular matrix which I made a symmetric matrix as follows:

P=P'+P

but that double counts the main diagonal and I should have done:

P=P'+P-Diagonal(P)

@imciner2
Copy link
Member

Glad to hear you found the problem. I'll go ahead and close this since it isn't in the OSQP.jl code.

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

No branches or pull requests

2 participants