oxfordcontrol / Clarabel.cpp

Clarabel.cpp: C/C++ interface to the Clarabel Interior-point solver for convex conic optimisation problems.
Apache License 2.0
32 stars 10 forks source link

Add CscMatrix functionality in C #1

Closed gaviny82 closed 1 year ago

gaviny82 commented 1 year ago

This PR adds a CscMatrix struct type in C to allow the C users to access the matrix properties when a CscMatrix instance is created.

A default solver prototype has been added and the example_lp has been updated to demonstrate the use of the CscMatrix objects.

Known issue:

forget is used here to allow the memory of matrix data to be managed by the C user. This is fine for matrices created by CscMatrix::new, which uses arrays provided without copying the data, but in other cases, where CscMatrix manages their own Vec, this will cause memory leaks. Examples: CscMatrix::zeros, CscMatrix::from