Einstein summation for multidimensional arrays

https://doi.org/10.1016/S0898-1221(02)00210-9Get rights and content
Under an Elsevier user license
open archive

Abstract

One of the most common data structures, at least in scientific computing, is the multidimensional array. Some numerical algorithms may conveniently be expressed as a generalized matrix multiplication, which computes a multidimensional array from two other multidimensional arrays. By adopting index notation with the Einstein summation convention, an elegant tool for expressing generalized matrix multiplications is obtained. Index notation is the succinct and compact notation primarily used in tensor calculus.

In this paper, we develop computer support for index notation as a domain specific language. Grammar and semantics are proposed, yielding an unambiguous interpretation algorithm. An object-oriented implementation of a C++ library that supports index notation is described.

A key advantage with computer support of index notation is that the notational gap between a mathematical index notation algorithm and its implementation in a computer language is avoided. This facilitates program construction as well as program understanding. Program examples that demonstrate the close resemblance between code and the original mathematical formulation are presented.

Keywords

Index notation
Mathematical software
Domain specific language
Tensor calculus

Cited by (0)

Research funded via a grant from the Norwegian Research Council.

I am very grateful to M. Haveraaen for his contributions, in particular concerning Section 3. I am also grateful to several friends for encouragement and valuable feedback.