Skip to content

dq.TimeQArray

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

Base class for time-dependent qarrays.

A timeqarray 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 (timeqarray) –

    Returns the timeqarray 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 timeqarray values (the array is always sorted, but does not necessarily contain unique values).

Arithmetic operation support

Timeqarrays support basic arithmetic operations -, +, * with other qarray-likes or timeqarrays.

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 timeqarray with the given time bounds.

TimeQArray.reshape

reshape(*shape: int) -> TimeQArray

Returns a reshaped copy of a timeqarray.

Parameters:

  • *shape –

    New shape, which must match the original size.

Returns:

  • New timeqarray with the given shape.

TimeQArray.broadcast_to

broadcast_to(*shape: int) -> TimeQArray

Broadcasts a timeqarray to a new shape.

Parameters:

  • *shape –

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

Returns:

  • New timeqarray with the given shape.

TimeQArray.conj

conj() -> TimeQArray

Returns the element-wise complex conjugate of the timeqarray.

Returns:

  • New timeqarray with element-wise complex conjuguated values.

TimeQArray.dag

dag() -> TimeQArray

Returns the adjoint (complex conjugate transpose) of the timeqarray.

Returns:

  • New timeqarray with adjoint values.

TimeQArray.squeeze

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

Squeezes a timeqarray.

Parameters:

  • axis –

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

Returns:

  • New timeqarray with squeezed shape.

TimeQArray.prefactor

prefactor(ts: ArrayLike) -> Array

Returns the timeqarray 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.