Frameworking the vectorized basic linear algebra for prototyping codes in MATLAB
Files
Date issued
2026
Journal Title
Journal ISSN
Volume Title
Publisher
Abstract
When writing high-performance code for numerical computations in a scripting language such as MATLAB, it is crucial to vectorize operations within large for-loops. However, this vectorization process often obscures the original mathematical structure, making the code less readable. This issue is particularly pronounced in finite element method (FEM) implementations, despite the inherently structured nature of FEM. A practical remedy is to decouple the vectorization layer from the mathematical logic of the code. This can be effectively achieved by building on top of already-vectorized basic linear algebra subprograms. Over the past 15 years, this idea has been applied in a series of works, resulting in fast, structured, and maintainable code. In this paper, we present a vectorized basic linear algebra package and introduce a formalism based on multilinear algebra to define and explain its functions. We also incorporate MATLAB’s recently introduced page-wise functions to enhance expressiveness. We provide examples such as computing normal vectors, volumes, and finite element assembly to demonstrate the clarity and efficiency of the approach. The resulting codes closely follow mathematical abstraction, facilitate reuse and extension, and support rapid development and prototyping by scientists, engineers, and students.
Description
Subject(s)
code vectorization, abstract linear algebra, tensor structures, triangular meshes, finite element method