File Exchange

image thumbnail

Tensor Utilities

version (31.6 KB) by André Flakke
Tensor Utilites for Tensor Manipulations


Updated 14 Sep 2018

View License

Tensor utilities for tensor operations like contractions, sub-tensor extractions, outer-products, tensor permutations, and matrix unfoldings. Some of these are operations which have the Kronecker product, matrix transpose and matrix multiplication as special cases, while here being generalized to tensors of arbitrary valence. Read the function headers for examples and user guidance.

Cite As

André Flakke (2020). Tensor Utilities (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)


Added functionality to compute the non-zero elements of the Levi-Cevita tensor of order N along with the respective coordinates in the Nth order tensor. Read the function headers for guidance and examples.

Modified the function 'tensorOuterProduct()' to accept 1. order tensors, i.e. vectors.

Added function tensorTranspose(T,P) for tensor permutations.

Forgot to add the file. Now it is added.

Added the function subTensor() which enables extraction of sub-tensors from a tensor.

Added reference: The functions are mostly based on material in Golub, Van Loan 'Matrix Computations', 4th ed. Some background material was found in Tolosa, Castillo 'From Vectors to Tensors'.

Added the function 'commuteKroneckerProduct()', which from knowledge of the dimensions of matrices A,B and the matrix K = kron(A,B), forms the matrix L = kron(B,A). I.e it commutes the kronecker product.

Added image.

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags