check_perturbation_index#

t3toolbox.backend.sampling_derivatives.check_perturbation_index(index, pp, shape=None)#
def check_perturbation_index(
        index: NDArray,                          # grid points, int, shape=(d,)+W
        pp:    typ.Sequence[NDArray],            # perturbation P, len=d, elm_shape=W+(Ni,)
        shape: typ.Optional[typ.Sequence[int]]   # ambient mode dims (Ni), len=d -- if given, also check P's mode dim
             = None,
) -> None:

Structural check (hard error): the perturbation P shares the sample stack W of the grid points index (shape (d,)+W), and – when shape is given (the ambient mode dims Ni, which the integer index does not carry) – P’s mode dim matches it. Used by the derivative-entries frontends; jit-safe.

Parameters:
  • index (NDArray)

  • pp (t3toolbox.backend.common.typ.Sequence[NDArray])

  • shape (t3toolbox.backend.common.typ.Optional[t3toolbox.backend.common.typ.Sequence[int]])

Return type:

None