Skip to content

dq.modulated

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

Instantiate a modulated time-array.

A modulated time-array 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)\).

  • array (array_like of shape (n, n)) –

    Constant array \(O_0\).

  • discontinuity_ts (array_like, optional) –

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

Returns

(time-array object of shape (..., n, n) when called) Callable object 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)
Array([[-0.+0.j, -1.+0.j],
       [-1.+0.j, -0.+0.j]], dtype=complex64)
>>> H(1.0)
Array([[0.+0.j, 1.+0.j],
       [1.+0.j, 0.+0.j]], dtype=complex64)