NumericsSparseMatrix (functions)

siconos.numerics.NSM_data(NumericsSparseMatrix *A) -> array_like (np.float64, 1D)[source]

Get the data part of sparse matrix.

Parameters:A – the sparse matrix
Returns:a pointer to the data array

siconos.numerics.NSM_diag_indices(NumericsMatrix *M) → CS_INT *[source]

return the set of indices corresponding to the diagonal elements of the matrix

Warning: should be better tested

Parameters:M – the matrix
Returns:the list of indices for the diagonal elements

siconos.numerics.NSM_extract_block(NumericsMatrix *M, array_like (np.float64, 1D)blockM, size_t pos_row, size_t pos_col, size_t block_row_size, size_t block_col_size) → None[source]

Extract a block from a sparse matrix.

  • M – matrix
  • blockM – dense storage for the block
  • pos_row – starting row for the block
  • pos_col – starting column for the block
  • block_row_size – block width
  • block_col_size – block height

siconos.numerics.NSM_fix_csc(CSparseMatrix *A) → None[source]

Check and fix a matrix, if needed.

Parameters:A – the matrix to check, modified if necessary to have ordered indices

siconos.numerics.NSM_free(NumericsSparseMatrix *A) → NumericsSparseMatrix *[source]

Free allocated space for a NumericsSparseMatrix.

Parameters:A – a NumericsSparseMatrix
Returns:NULL on success

siconos.numerics.NSM_free_p(None *p) → None[source]

Free a workspace related to a LU factorization.

Parameters:p – the structure to free

siconos.numerics.NSM_get_origin(NumericsSparseMatrix *M) → CSparseMatrix *[source]

return the sparse matrix that has the original label

Parameters:M – the matrix
Returns:the sparse matrix that is at the origin, or NULL if an error occur

siconos.numerics.NSM_linearSolverParams(NumericsMatrix *A) → NSM_linear_solver_params *[source]

Get linear solver parameters with initialization if needed.

Parameters:A – a NumericsMatrix.
Returns:a pointer on parameters.

siconos.numerics.NSM_linearSolverParams_free(NSM_linear_solver_params *p) → NSM_linear_solver_params *[source]

Free allocated space for NSM_linear_solver_params.

Parameters:p – a NSM_linear_solver_params
Returns:NULL on success

siconos.numerics.NSM_linearSolverParams_new(None) → NSM_linear_solver_params *[source]

New and empty NSM_linear_solver_params.

Returns:a pointer on the allocated space.

siconos.numerics.NSM_new(None) → NumericsSparseMatrix *[source]

New and empty NumericsSparseMatrix with correctly initialized fields.

Returns:a pointer on the allocated space.

siconos.numerics.NSM_new_from_file(FILE *file) → NumericsSparseMatrix *[source]

New and empty NumericsSparseMatrix with correctly initialized fields.

Returns:a pointer on the allocated space.

siconos.numerics.NSM_nnz(CSparseMatrix * A) → size_t[source]

get the number of non-zero (nnz) in a sparse matrix

Parameters:A – the matrix
Returns:the number of non-zero elements in the matrix

siconos.numerics.NSM_null(NumericsSparseMatrix *A) → None[source]

Initialize the fields of a NumericsSparseMatrix.

Parameters:A – the sparse matrix

siconos.numerics.NSM_origin(NumericsSparseMatrix *M)[source]

return the origin of a sparse part of a matrix

Parameters:M – the matrix
Returns:-1 if the matrix has no sparse representation, the origin otherwise

siconos.numerics.NSM_solver_data(NSM_linear_solver_params *p) → None *[source]

Get the LU factors for cs_lusol.

Parameters:p – the structure holding the data for the solver

siconos.numerics.NSM_to_dense(NumericsSparseMatrix * A, array_like (np.float64, 1D)B) → int[source]

siconos.numerics.NSM_triplet_eye(int size) → NumericsSparseMatrix *[source]

siconos.numerics.NSM_workspace(NSM_linear_solver_params *p) -> array_like (np.float64, 1D)[source]

Get the workspace for the sparse solver.

Parameters:p – the structure holding the data for the solver
Returns:the (double) workspace

siconos.numerics.NSM_write_in_file(NumericsSparseMatrix *m, FILE *file) → None[source]