Appendix A
C API

The API can be used to extend CVXOPT with interfaces to external C routines and libraries. A C program that creates or manipulates the dense or sparse matrix objects defined in CVXOPT must include the cvxopt.h header file in the src directory of the distribution.

Before the C API can be used in an extension module it must be initialized by calling the macro import_cvxopt. As an example we show the module initialization from the cvxopt.blas module, which itself uses the API:

PyMODINIT_FUNC initblas(void)  
{  
  PyObject *m;  
 
  m = Py_InitModule3("cvxopt.blas", blas_functions, blas__doc__);  
 
  if (import_cvxopt() < 0)  
    return;  
}

 A.1 Dense Matrices
 A.2 Sparse Matrices