UT3Tangent.apply_derivatives#
- t3toolbox.uniform_manifold.UT3Tangent.apply_derivatives(ww, pp, order)#
def apply_derivatives( self, ww: typ.Sequence[NDArray], # apply 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 ) -> NDArray: # scalar jets, shape=(order+1,)+W+K+C
Symmetric all-modes apply derivatives (derivative twin of
apply(); the bare𝒥, a scalar jet per stack element). Structural precondition as inprobe_derivatives(). Uniform mirror ofapply_derivatives().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)) >>> yj = v.apply_derivatives(ww, pp, 3) >>> print(yj.shape, bool(np.allclose(yj[0], v.apply(ww)))) # (order+1,); order 0 == apply (4,) True