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 stacky_i^(t) = d^t/ds^t [probe(X + s P)]_i|_0fort=0..order– the derivative analogue ofprobe(), obtained by perturbing every probe vector in the same directionP. Index0is the ordinaryprobe(). Stacksorder + W + K + C(order outermost; sample stackW, tangent stackK, frame stackC). The pointsX(ww) and the perturbationsP(pp) must share the sample stackW.See
docs/symmetric_probe_derivatives.tex.See also
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]