Skip to content

Add a pure C interface - #1

Open
jgillis wants to merge 8 commits into
StanfordASL:mainfrom
jgillis:c-interface
Open

jgillis wants to merge 8 commits into
StanfordASL:mainfrom
jgillis:c-interface

Conversation

@jgillis

@jgillis jgillis commented Oct 8, 2026 •

Copy link
Copy Markdown

Hi! I'd be interested in interfacing elastiqp with CasADi.
Since we care about C codegeneration, such interface works best when the solver has a C API.

Here is one modeled on daqp's C interface.

@danielpmorton

Copy link
Copy Markdown
Member

Hi @jgillis, great to get in touch! I'm so impressed by your work on CasADi and it would be quite cool to have an CasADi/ElastiQP interface. I ran a few tests on your PR locally and things are looking good already. I'll take a deeper look through the code and get back to you shortly!

@jgillis

jgillis commented Oct 8, 2026 •

Copy link
Copy Markdown
Author

I was working on an experimental slack extension for our nlpsol and conic interfaces, so your elastiQP solver would be a great first fit.

Co-authored-by: Joris Gillis <joris@yacoda.com>
@danielpmorton

Copy link
Copy Markdown
Member

Hi @jgillis ! I made a couple changes to better align the interfaces between the C and C++, and added a small helper function to reduce some extra calls in the C. If you think this looks good to you as well, and what you need for CasADi, I'll merge it in soon. Thanks again for making the PR!

@danielpmorton

Copy link
Copy Markdown
Member

Oh, one question: I noticed that this interface uses row-major matrices, is that preferable for CasADi?

@jgillis

jgillis commented Oct 11, 2026 •

Copy link
Copy Markdown
Author

Good point, CasADi is actually column-major. This merits some extra thought..
From the CasADi side we have hold an ng-by-n column-major (sparse) matrix. With ng spanning equalities and inequalities mixed.

@danielpmorton

danielpmorton commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Here's a quick patch to use column-major matrices -- if this branch looks good for your use-cases, let me know and I'll do a final cleanup pass and merge!

(helps simplify the C interface)
felt like this was unnecessary complexity now that we have the column-major
structure in the C api and the Ref inputs

This branch has not been deployed

No deployments
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.

2 participants