Skip to content

dq.TimeQArray

TimeQArray(*, tstart: float | None = None, tend: float | None = None)

Base class for time-dependent qarrays.

A time-qarray is a callable object that returns a qarray for any time \(t\). It is used to define time-dependent operators for Dynamiqs solvers.

Attributes

  • dtype (numpy.dtype) –

    Data type.

  • shape (tuple of int) –

    Shape.

  • ndim (int) –

    Number of dimensions in the shape.

  • layout (Layout) –

    Data layout, either dq.dense or dq.dia.

  • dims (tuple of ints) –

    Hilbert space dimension of each subsystem.

  • mT (time-qarray) –

    Returns the time-qarray transposed over its last two dimensions.

  • vectorized (bool) –

    Whether the underlying qarray is non-vectorized (ket, bra or operator) or vectorized (operator in vector form or superoperator in matrix form).

  • tstart (float | None) –

    The returned qarray is null for all times \(t < t_{start}\) (ignored if None).

  • tend (float | None) –

    The returned qarray is null for all times \(t \geq t_{end}\) (ignored if None).

  • discontinuity_ts (Array) –

    Times at which there is a discontinuous jump in the time-qarray values (the array is always sorted, but does not necessarily contain unique values).

Arithmetic operation support

Time-qarrays support basic arithmetic operations -, +, * with other qarray-likes or time-qarrays.

TimeQArray.clip

clip(tstart: float | None, tend: float | None) -> TimeQArray

Set the start and/or end time beyond which the returned qarray is null.

Parameters

  • tstart –

    The returned qarray is null for all times \(t < t_{start}\) (ignored if None).

  • tend –

    The returned qarray is null for all times \(t \geq t_{end}\) (ignored if None).

Returns

New time-qarray with the given time bounds.

TimeQArray.reshape

reshape(*shape: int) -> TimeQArray

Returns a reshaped copy of a time-qarray.

Parameters

  • *shape –

    New shape, which must match the original size.

Returns

New time-qarray with the given shape.

TimeQArray.broadcast_to

broadcast_to(*shape: int) -> TimeQArray

Broadcasts a time-qarray to a new shape.

Parameters

  • *shape –

    New shape, which must be compatible with the original shape.

Returns

New time-qarray with the given shape.

TimeQArray.conj

conj() -> TimeQArray

Returns the element-wise complex conjugate of the time-qarray.

Returns

New time-qarray with element-wise complex conjuguated values.

TimeQArray.dag

dag() -> TimeQArray

Returns the adjoint (complex conjugate transpose) of the time-qarray.

Returns

New time-qarray with adjoint values.

TimeQArray.squeeze

squeeze(axis: int | None = None) -> TimeQArray

Squeezes a time-qarray.

Parameters

  • axis –

    Axis to squeeze. If None, all axes with dimension 1 are squeezed.

Returns

New time-qarray with squeezed shape.

TimeQArray.prefactor

prefactor(ts: ArrayLike) -> Array

Returns the time-qarray prefactor at specific times.

Parameters

  • ts (array-like of shape (...)) –

    Times at which to evaluate the prefactor.

Returns

(array of shape (...)) Prefactor values at times ts.