T3Tangent.probe_derivatives#

t3toolbox.manifold.T3Tangent.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.Sequence[NDArray]:             # len=d, elm_shape=(order+1,)+W+K+C+(Ni,)

Symmetric directional derivatives of probing this tangent vector, in one repeated direction.

Returns, for each mode i, the stack y_i^(t) = d^t/ds^t [probe(X + s P)]_i|_0 for t=0..order – the derivative analogue of probe(), obtained by perturbing every probe vector in the same direction P. Index 0 is the ordinary probe(). Stacks order + W + K + C (order outermost; sample stack W, tangent stack K, frame stack C). The points X (ww) and the perturbations P (pp) must share the sample stack W.

See docs/symmetric_probe_derivatives.tex.

Examples

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.frame_variations_format as bvf
>>> import t3toolbox.manifold as t3m
>>> np.random.seed(0)
>>> x = t3.TuckerTensorTrain.randn((10, 11, 12), (5, 6, 4), (1, 2, 3, 1))
>>> frame, variations = bvf.t3_orthogonal_representations(x)
>>> v = t3m.T3Tangent(frame, variations)
>>> 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]
Parameters:
  • ww (t3toolbox.backend.common.typ.Sequence[NDArray])

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

  • order (int)

Return type:

t3toolbox.backend.common.typ.Sequence[NDArray]