build_compression_matrix

(function from pyomo.contrib.pynumero.interfaces.utils)

pyomo.contrib.pynumero.interfaces.utils.build_compression_matrix(compression_mask)[source]

Return a sparse matrix CM of ones such that compressed_vector = CM*full_vector based on the compression mask

Parameters:

compression_mask (np.ndarray or pyomo.contrib.pynumero.sparse.block_vector.BlockVector)

Returns:

cm – The compression matrix

Return type:

coo_matrix or BlockMatrix