class chainer.utils.CooMatrix(data, row, col, shape, order=None, requires_grad=False)[source]

A sparse matrix in COO format.

  • data (N-dimensional array) – The entries of the matrix. The entries are usually non-zero-elements in the matrix.

  • row (N-dimensional array) – The row indices of the matrix entries.

  • col (N-dimensional array) – The column indices of the matrix entries.

  • shape (tuple of int) – The shape of the matrix in dense format.

  • order ('C', 'F', 'other' or None) – If 'C', the maxtix is assumed that its row indices are sorted. If 'F', the matrix is assumed that its column indices are sorted. If 'other', the matrix is assumed as neither ‘C’ order nor ‘F’ order. If None (this is the default), the matrix is automatically checked if it is ‘C’ order, ‘F’ order or another. This information will be used by some functions like sparse_matmul() as a hint to improve performance.

  • requires_grad (bool) – If True, gradient of this sparse matrix will be computed in back-propagation.

See also

See to_coo() for how to construct a COO matrix from an array.



Returns a dense matrix format of this sparse matrix.