Skip to content

Instantly share code, notes, and snippets.

@samdphillips
Last active December 16, 2021 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samdphillips/6a76d32124e9bf736a49c76cd1cb5239 to your computer and use it in GitHub Desktop.
Save samdphillips/6a76d32124e9bf736a49c76cd1cb5239 to your computer and use it in GitHub Desktop.
#lang racket/base
(require ffi/unsafe)
(define-cstruct _csc
([nzmax _int] ; ///< maximum number of entries
[m _int] ; ///< number of rows
[n _int] ; ///< number of columns
[p* _pointer] ; ///< column pointers (size n+1); col indices (size nzmax)
; start from 0 when using triplet format (direct KKT
; matrix formation)
[i* _pointer] ; ///< row indices, size nzmax starting from 0
[x* _pointer] ; ///< numerical values, size nzmax
[nz _int]))
;; write functions using `ptr-ref` and `ptr-set!` to access contents of p* i* x*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment