UT3Tangent.probe_derivatives#

t3toolbox.uniform_manifold.UT3Tangent.probe_derivatives(ww, pp, order)#
def probe_derivatives(
        self,
        ww:     typ.Sequence[NDArray],  # probe vectors X,        len=d, elm_shape=W+(Ni,)
        pp:     typ.Sequence[NDArray],  # perturbation vectors P, len=d, elm_shape=W+(Ni,)
        order:  int,                    # highest derivative order
) -> typ.Tuple[NDArray, ...]:           # len=d, ith elm_shape=(order+1,)+W+K+C+(Ni,)

Symmetric directional derivatives of probe(), in one repeated direction P (pp): the forward Riemannian Jacobian derivatives y_i^(t) = d^t/ds^t [probe(X + s P)]_i|_0 for t=0..order (order 0 is probe(); the bare 𝒥, no gauge Π). ww/pp share the sample stack W; stacks order + W + K + C. Uniform mirror of probe_derivatives().

No numerical precondition (gauge-invariant, any frame). Structural precondition (hard error): P (pp) shares the sample stack W and mode dims of X (ww).

Examples

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.uniform_tucker_tensor_train as ut3
>>> import t3toolbox.uniform_manifold as ut3m
>>> np.random.seed(0)
>>> x = ut3.UniformTuckerTensorTrain.from_t3(t3.TuckerTensorTrain.randn((10, 11, 12), (5, 6, 4), (1, 2, 3, 1)))
>>> v = ut3m.UNIFORM_COREWISE.randn(ut3m.UNIFORM_MANIFOLD.frame(x))
>>> ww = (np.random.randn(10), np.random.randn(11), np.random.randn(12))
>>> pp = (np.random.randn(10), np.random.randn(11), np.random.randn(12))
>>> zj = v.probe_derivatives(ww, pp, 3)
>>> print([z.shape for z in zj])                                    # (order+1,) + (Ni,)
[(4, 10), (4, 11), (4, 12)]
>>> print([bool(np.allclose(z[0], z0)) for z, z0 in zip(zj, v.probe(ww))])   # order 0 == probe
[True, True, True]

P must match X’s sample stack and mode dims (structural, raises):

>>> v.probe_derivatives(ww, (np.random.randn(10), np.random.randn(11), np.random.randn(99)), 3)
...
Traceback (most recent call last):
    ...
ValueError
Parameters:
  • ww (t3toolbox.backend.common.typ.Sequence[NDArray])

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

  • order (int)

Return type:

t3toolbox.backend.common.typ.Tuple[NDArray, Ellipsis]