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 pure C function CscMatrix_f64_new is added to create a matrix and free_CscMatrix_f64 should be called to free the memory of the matrix.
A CscMatrix pointer in C can be passed to Rust functions which take a CscMatrix reference as an argument.
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
Solved by adding a field to indicate the ownership of arrays in a CscMatrix struct to control memory deallocation.
This PR adds a
CscMatrix
struct type in C to allow the C users to access the matrix properties when aCscMatrix
instance is created.CscMatrix_f64_new
is added to create a matrix andfree_CscMatrix_f64
should be called to free the memory of the matrix.CscMatrix
pointer in C can be passed to Rust functions which take aCscMatrix
reference as an argument.A default solver prototype has been added and the
example_lp
has been updated to demonstrate the use of theCscMatrix
objects.Known issue: