TL;DR
This paper introduces three new MATLAB classes – tensor, cp_tensor, and tucker_tensor – designed to simplify the development and prototyping of algorithms for manipulating multidimensional arrays (tensors). By providing a more intuitive interface for tensor operations like multiplication and decomposition, these classes aim to accelerate research in fields that heavily rely on tensor analysis.
What Problem Does This Paper Address?
Working with multidimensional arrays, or tensors, in MATLAB can be cumbersome. While MATLAB supports multidimensional arrays (MDAs), it lacks built-in functions for complex tensor operations such as tensor multiplication or representing tensors in decomposed forms like CP or Tucker. Researchers often have to manually reshape tensors into matrices, perform matrix operations, and then reshape the results back into tensors. This process is not only tedious but also prone to errors and can obscure the underlying mathematical concepts. This paper addresses this gap by providing a set of MATLAB classes that offer a more direct and user-friendly way to handle tensor manipulations, thereby facilitating faster algorithm prototyping and development.
Methods
The authors introduce three core MATLAB classes:
tensor: This class provides a direct representation of dense tensors, extending MATLAB's native multidimensional array functionality. It explicitly stores tensor dimensions, including trailing singleton dimensions, which MATLAB's native arrays often drop. Crucially, it overloads standard MATLAB operators and functions to support tensor-specific operations.cp_tensor: This class represents tensors in Canonical Polyadic (CP) or PARAFAC decomposition form. A CP tensor is expressed as a sum of rank-1 tensors, which are outer products of vectors. This class allows for efficient storage and manipulation of such decomposed tensors.tucker_tensor: This class represents tensors in Tucker decomposition form. A Tucker tensor is defined by a core tensor and a set of factor matrices for each mode. Similar tocp_tensor, it facilitates efficient representation and manipulation of these decomposed forms.
The paper also introduces new notation and corresponding MATLAB functions for key tensor operations:
- n-mode product: This operation allows for multiplying a tensor by matrices along specific modes (dimensions). The authors propose notation like
A ×n Uand provide theproduct(A, U, n)MATLAB function. - Contracted n-mode product: This is a variation of the n-mode product where a singleton dimension is dropped, leading to a potentially different result shape and order. The authors introduce notation like
A ānuand theproduct(A, u, n, 'vec')function. - Matricization: This process transforms a tensor into a matrix by rearranging its elements. The paper discusses two definitions (De Lathauwer et al. and Kiers) and provides the
matricize(T, n)function. - Tensor multiplication: The paper defines the inner product of two tensors and the outer product of vectors.
The authors demonstrate the utility of these classes by implementing algorithms from existing literature, such as the higher-order power method and higher-order orthogonal iteration.
Datasets
Not discussed in the paper. The paper focuses on the development of MATLAB classes and algorithms, using randomly generated tensors for demonstration purposes rather than specific datasets.
Key Insights and Ideas
- Bridging the gap between theory and practice: The primary insight is the creation of a MATLAB framework that directly maps tensor algebra concepts (like n-mode products and decompositions) to intuitive programming constructs, significantly lowering the barrier to entry for tensor-based algorithm development.
- Standardized notation for tensor operations: The authors propose and adopt a consistent notation for tensor operations, particularly for n-mode products and contracted products, which they argue clarifies ambiguities present in existing literature and facilitates implementation.
- The power of object-oriented programming for scientific computing: The paper showcases how object-oriented programming in MATLAB can be effectively used to encapsulate complex mathematical objects (tensors) and their associated operations, leading to cleaner, more readable, and maintainable code for advanced numerical methods.
- Facilitating algorithm prototyping: By abstracting away the complexities of manual tensor reshaping and manipulation, the developed classes allow researchers to focus on the algorithmic logic, thus speeding up the prototyping and testing phases of research.
Key Results
The paper successfully introduces and demonstrates the functionality of three MATLAB classes (tensor, cp_tensor, tucker_tensor) and associated functions for tensor manipulation. The authors show that these classes can be used to implement existing tensor algorithms, such as the higher-order power method and higher-order orthogonal iteration, with improved clarity and ease compared to traditional matrix-based approaches. The examples provided illustrate the creation, manipulation, and conversion between dense and decomposed tensor forms, as well as the application of n-mode products.
Limitations and Future Work
The authors explicitly state that their current MATLAB implementations are not optimized for performance or memory usage. They emphasize that their primary goal was consistency and ease of use.
Future work suggested by the authors includes:
- Enhancing performance and memory efficiency: Optimizing the existing classes and functions to handle larger tensors and more computationally intensive tasks.
- Adding more functionality: Expanding the library with additional tensor operations and algorithms.
- Further development of notation: Continuing to refine and standardize mathematical notation for tensor operations to address any remaining ambiguities.
Summary updated