pwc

Graph.pwc(durations, values, time_dimension=0, *, name=None)

Creates a piecewise-constant function of time.

Parameters
  • durations (np.ndarray (1D, real)) – The durations \(\{\delta t_n\}\) of the \(N\) constant segments.

  • values (np.ndarray or Tensor) – The values \(\{v_n\}\) of the function on the constant segments. The dimension corresponding to time_dimension must be the same length as durations. To create a batch of \(B_1 \times \ldots \times B_n\) piecewise-constant tensors of shape \(D_1 \times \ldots \times D_m\), provide this values parameter as an object of shape \(B_1\times\ldots\times B_n\times N\times D_1\times\ldots\times D_m\).

  • time_dimension (int, optional) – The axis along values corresponding to time. All dimensions that come before the time_dimension are batch dimensions: if there are \(n\) batch dimensions, then time_dimension is also \(n\). Defaults to 0, which corresponds to no batch. Note that you can pass a negative value to refer to the time dimension.

  • name (str, optional) – The name of the node.

Returns

The piecewise-constant function of time \(v(t)\), satisfying \(v(t)=v_n\) for \(t_{n-1}\leq t\leq t_n\), where \(t_0=0\) and \(t_n=t_{n-1}+\delta t_n\). If you provide a batch of values, the returned Pwc represents a corresponding batch of \(B_1 \times \ldots \times B_n\) functions \(v(t)\), each of shape \(D_1 \times \ldots \times D_m\).

Return type

Pwc

See also

pwc_operator()

Create Pwc operators.

pwc_signal()

Create Pwc signals from (possibly complex) values.

pwc_sum()

Sum multiple Pwcs.