build_sparse_matrix

build_sparse_matrix[ValueType](
array: np.ndarray,
row_group_indices: collections.abc.Sequence[int] | None = None,
) → stormpy.datastructures.SparseMatrix

Select a specialization with build_sparse_matrix[ValueType](...).

The default specialization is build_sparse_matrix[float].

Template arguments:

  • ValueType (type)

Supported specializations: build_sparse_matrix[float], build_sparse_matrix[stormpy.numbers.Rational], build_sparse_matrix[stormpy.numbers.RationalFunction], build_sparse_matrix[stormpy.numbers.Interval], build_sparse_matrix[stormpy.numbers.RationalInterval].

Build a sparse matrix from a two-dimensional NumPy array.

Zero entries are skipped. The value type is selected by subscription, e.g. build_sparse_matrix[stormpy.Rational](array). It defaults to float.

Parameters:
  • array – Two-dimensional array containing matrix values.

  • row_group_indices – Optional ascending starting row indices of row groups.

Returns:

Sparse matrix with the shape of the input array.