[numerics,swig] remove cs_sparse, since it is replaced by scipy.sparse.
};
-#ifdef SICONOS_USE_CXSPARSE
-#ifdef SICONOS_INT64
-#define cs_sparse cs_dl_sparse
-#else
-#define cs_sparse cs_di_sparse
-#endif
-#endif
-
-/* xhub: I'm not sure it's a good idea to duplicate this here ... it
- * is already defined in csparse.h. Steve: Only alternative is to
- * include csparse.h/cs.h, but then we wrap all of csparse/cxsparse,
- * and the di/dl naming conflicts cause issues. */
-
-typedef struct cs_sparse /* matrix in compressed-column or triplet form */
-{
- CS_INT nzmax ; /* maximum number of entries */
- CS_INT m ; /* number of rows */
- CS_INT n ; /* number of columns */
- CS_INT *p ; /* column pointers (size n+1) or col indices (size nzmax) */
- CS_INT *i ; /* row indices, size nzmax */
- double *x ; /* numerical values, size nzmax */
- CS_INT nz ; /* # of entries in triplet matrix, -1 for compressed-col */
-} cs;
-
-%extend cs_sparse
-{
-%fragment("NumericsMatrix");
-
- // from a scipy.sparse matrix
- cs_sparse(SN_OBJ_TYPE *obj)
- {
- int array_data_ctrl_ = 0;
- int array_i_ctrl_ = 0;
- int array_p_ctrl_ = 0;
- int alloc_ctrl_ = 0;
- SN_ARRAY_TYPE *array_data_ = NULL, *array_i_ = NULL, *array_p_ = NULL;
- CSparseMatrix* M = NULL;
-
- CSparseMatrix Mtmp;
- CSparseMatrix* Mtmp_p = &Mtmp;
-
-#ifdef SWIGPYTHON
- int res = cs_convert_from_scipy_sparse(obj, &Mtmp_p, &array_data_, &array_data_ctrl_, &array_i_, &array_i_ctrl_, &array_p_, &array_p_ctrl_, &alloc_ctrl_);
-#endif /* SWIGPYTHON */
-
-#ifdef SWIGMATLAB
- int res = cs_convert_from_matlab(obj, &Mtmp_p, &array_data_, &array_data_ctrl_, &array_i_, &array_i_ctrl_, &array_p_, &array_p_ctrl_, &alloc_ctrl_);
-#endif /* SWIGMATLAB */
-
- if (!res) { goto fail; }
- else if (res < 0) { SWIG_Error(SWIG_RuntimeError, "Error the matrix is not sparse!"); goto fail; }
-
- M = (CSparseMatrix *) calloc(sizeof(CSparseMatrix), 1);
- if(!M) { SWIG_Error(SWIG_RuntimeError, "Failed to allocate a cs_sparse"); goto fail; }
-
- // perform a deep copy since we do not have any mechanism to record the fact we use data from the python object
- NM_copy_sparse(Mtmp_p, M);
-
-fail:
- target_mem_mgmt(array_data_ctrl_, array_data_);
- target_mem_mgmt(array_i_ctrl_, array_i_);
- target_mem_mgmt(array_p_ctrl_, array_p_);
-
- NM_clean_cs(Mtmp_p, alloc_ctrl_);
-
- return M;
-
- }
-
- ~cs_sparse()
- {
- cs_spfree($self);
- }
-}
-
%extend SparseBlockStructuredMatrix
{
~SparseBlockStructuredMatrix()
