Skip to content

dq.TimeArray

Base class for time-dependent arrays.

A time-array is a callable object that returns a JAX array 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.

  • mT (TimeArray) –

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

  • ndim (int) –

    Number of dimensions.

  • discontinuity_ts (Array | None) –

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

Arithmetic operation support

Time-arrays support elementary operations:

  • negation (__neg__),
  • left-and-right element-wise addition/subtraction with other arrays or time-arrays (__add__, __radd__, __sub__, __rsub__),
  • left-and-right element-wise multiplication with other arrays (__mul__, __rmul__).

TimeArray.reshape abstractmethod

reshape(*shape: int) -> TimeArray

Returns a reshaped copy of a time-array.

Parameters

  • *shape –

    New shape, which must match the original size.

Returns

New time-array object with the given shape.

TimeArray.broadcast_to abstractmethod

broadcast_to(*shape: int) -> TimeArray

Broadcasts a time-array to a new shape.

Parameters

  • *shape –

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

Returns

New time-array object with the given shape.

TimeArray.conj abstractmethod

conj() -> TimeArray

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

Returns

New time-array object with element-wise complex conjuguated values.

TimeArray.squeeze

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

Squeeze a time-array.

Parameters

  • axis –

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

Returns

New time-array object with squeezed_shape

TimeArray.__call__ abstractmethod

__call__(t: ScalarLike) -> Array

Returns the time-array evaluated at a given time.

Parameters

  • t –

    Time at which to evaluate the array.

Returns

Array evaluated at time \(t\).