Skip to content

dq.modulated

modulated(
    f: callable[[float], Scalar | Array],
    qarray: QArrayLike,
    *,
    discontinuity_ts: ArrayLike | None = None
) -> ModulatedTimeQArray

Instantiate a modulated time-qarray.

A modulated time-qarray is defined by \(O(t) = f(t) O_0\) where \(f(t)\) is a time-dependent scalar. The function \(f\) is defined by passing a Python function with signature f(t: float) -> Scalar | Array that returns a scalar or an array of shape (...) for any time \(t\).

Parameters

  • f (function returning scalar or array of shape (...)) –

    Function with signature f(t: float) -> Scalar | Array that returns the modulating factor \(f(t)\).

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

    Constant qarray \(O_0\).

  • discontinuity_ts (array-like, optional) –

    Times at which there is a discontinuous jump in the function values.

Returns

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

Examples

>>> f = lambda t: jnp.cos(2.0 * jnp.pi * t)
>>> H = dq.modulated(f, dq.sigmax())
>>> H(0.5)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=2
[[   â‹…    -1.+0.j]
 [-1.+0.j    â‹…   ]]
>>> H(1.0)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=2
[[  â‹…    1.+0.j]
 [1.+0.j   â‹…   ]]