autopdex.solver.scipy_assembling

autopdex.solver.scipy_assembling(tangent_with_duplicates, verbose, free_dofs)[source]

Convert a JAX BCOO matrix to a SciPy CSR matrix while summing duplicates.

This function converts a JAX BCOO matrix, which may contain duplicate entries, into a SciPy CSR matrix. It optionally deletes rows and columns corresponding to Dirichlet degrees of freedom.

Parameters:
  • tangent_with_duplicates (jax.experimental.sparse.BCOO) – The input JAX BCOO matrix.

  • verbose (int) – Verbosity level. If >= 2, timing information is printed.

  • free_dofs (array or None) – Boolean array indicating which degrees of freedom are free. If not None, rows and columns corresponding to Dirichlet DOFs are removed from the matrix.

Returns:

The converted and possibly reduced CSR matrix.

Return type:

scipy.sparse.csr_matrix