Skip to content

dq.constant

constant(qarray: QArrayLike) -> ConstantTimeQArray

Instantiate a constant time-qarray.

A constant time-qarray is defined by \(O(t) = O_0\) for any time \(t\), where \(O_0\) is a constant qarray.

Parameters

  • qarray (qarray-like of shape (..., n, n)) –

    Constant qarray \(O_0\).

Returns

(time-qarray of shape (..., n, n) when called) Callable returning \(O_0\) for any time \(t\).

Examples

>>> H = dq.constant(dq.sigmaz())
>>> H(0.0)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=1
[[ 1.+0.j    â‹…   ]
 [   â‹…    -1.+0.j]]
>>> H(1.0)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=1
[[ 1.+0.j    â‹…   ]
 [   â‹…    -1.+0.j]]