brainunit.sparse.csc_todense

Contents

brainunit.sparse.csc_todense#

brainunit.sparse.csc_todense(mat)[source]#

Convert a CSC-format sparse matrix to a dense matrix.

Parameters:

mat (CSC) – The CSC sparse matrix to convert.

Returns:

Dense 2-D array equivalent to mat.

Return type:

Array | saiunit.Quantity

Raises:

TypeError – If mat is not an instance of CSC.

Examples

>>> import jax.numpy as jnp
>>> import saiunit as u
>>> import saiunit.sparse as susparse
>>> dense = jnp.array([[5., 0.], [0., 6.]])
>>> csc = susparse.csc_fromdense(dense)
>>> susparse.csc_todense(csc)
Array([[5., 0.],
       [0., 6.]], dtype=float32)