constant_sparse_pwc_operator

Graph.constant_sparse_pwc_operator(duration, operator)

Create a constant sparse piecewise-constant operator over a specified duration.

Parameters:
  • duration (float) – The duration \(\tau\) for the resulting piecewise-constant operator.

  • operator (numpy.ndarray or scipy.sparse.spmatrix or Tensor) – The sparse operator \(A\). If you pass a Tensor or NumPy array, it will be internally converted into a sparse representation.

Returns:

The constant operator \(t\mapsto A\) (for \(0\leq t\leq\tau\)).

Return type:

SparsePwc

See also

Graph.constant_pwc_operator

Corresponding operation for Pwcs.

Graph.sparse_pwc_hermitian_part

Hermitian part of a SparsePwc operator.

Graph.sparse_pwc_operator

Create SparsePwc operators.

Graph.sparse_pwc_sum

Sum multiple SparsePwcs.

Examples

Create a constant sparse PWC operator.

>>> from scipy.sparse import coo_matrix
>>> sigma_x = np.array([[0, 1], [1, 0]])
>>> graph.constant_sparse_pwc_operator(duration=0.1, operator=coo_matrix(sigma_x))
<SparsePwc: operation_name="constant_sparse_pwc_operator", value_shape=(2, 2)>

See more examples in the How to simulate large open system dynamics user guide.