t3toolbox.backend.contractions.Mio_No_to_MNi ============================================ .. py:function:: t3toolbox.backend.contractions.Mio_No_to_MNi(Mio: t3toolbox.backend.common.NDArray, No: t3toolbox.backend.common.NDArray, use_jax: bool = False) -> t3toolbox.backend.common.NDArray Computes vectorized einsum io,o->i, with vectorization over io, o, or both N and M are the vectorization indices, which may be groups of indices. .. rubric:: Examples Vectorize over both N and M: >>> import numpy as np >>> from t3toolbox.utils.contractions import Mio_No_to_MNi >>> Mio = np.random.randn(5,6, 10,13) >>> No = np.random.randn(2,3,4, 13) >>> result = Mio_No_to_MNi(Mio, No) >>> result2 = np.einsum('uvio,xyzo->uvxyzi', Mio, No) >>> print(result.shape == result2.shape) True >>> print(np.linalg.norm(result - result2)) 0.0 Vectorize over N only >>> import numpy as np >>> from t3toolbox.utils.contractions import Mio_No_to_MNi >>> Mio = np.random.randn(10,13) >>> No = np.random.randn(2,3,4, 13) >>> result = Mio_No_to_MNi(Mio, No) >>> result2 = np.einsum('io,xyzo->xyzi', Mio, No) >>> print(result.shape == result2.shape) True >>> print(np.linalg.norm(result - result2)) 0.0 Vectorize over both M only: >>> import numpy as np >>> from t3toolbox.utils.contractions import Mio_No_to_MNi >>> Mio = np.random.randn(5,6, 10,13) >>> No = np.random.randn(13) >>> result = Mio_No_to_MNi(Mio, No) >>> result2 = np.einsum('uvio,o->uvi', Mio, No) >>> print(result.shape == result2.shape) True >>> print(np.linalg.norm(result - result2)) 0.0 No vectorization: >>> import numpy as np >>> from t3toolbox.utils.contractions import Mio_No_to_MNi >>> Mio = np.random.randn(10,13) >>> No = np.random.randn(13) >>> result = Mio_No_to_MNi(Mio, No) >>> result2 = np.einsum('io,o->i', Mio, No) >>> print(result.shape == result2.shape) True >>> print(np.linalg.norm(result - result2)) 0.0