Einsum
In linear algebra and mathematical physics, there is a notational convention called Einstein Notation. The python package numpy implements a function called einsum, which is the first hit when googling the term. Several Julia packages exists that implement einsum functionality.
Packages
Tullio.jl
This package implements a macro@tullio
, which it describes as a very flexible einsum macro. It understands many array operations written in index notation – not just matrix multiplication and permutations, but also convolutions, stencils, scatter/gather, and broadcasting.
Einsum.jl
From README.md of this package:This package exports a single macro @einsum, which implements similar notation to the Einstein summation convention to flexibly specify operations on Julia Arrays, similar to numpy's einsum function (but more flexible!).
OMEinsum.jl
From README.md of this package:This is a repository for the Google Summer of Code project on Differentiable Tensor Networks. It implements one function that both computer scientists and physicists love, the Einstein summation
Tensorial.jl
From the README of this package:Tensorial.jl provides statically sized Tensor type that is compatible with
AbstractArray
, similar toSArray
from StaticArrays.jl. In addition to supporting basic AbstractArray operations, the package offers a tensorial interface and several advanced features:
Contraction, tensor product (⊗), and a flexible
@einsum
macro for Einstein summation conventionA
@Symmetry
macro to define the tensor symmetries, eliminating unnecessary calculationsAutomatic differentiation via
gradient
andhessian
functions, leveraging ForwardDiff.jlPerformance comparable to SArray
TensorOperations.jl
TensorCast.jl
ArrayMeta.jl
ArrayMeta.jl exists, but the package is not maintained and registered.
Tortilla.jl
Tortilla.jl was announced in JuliaCon2018, but the package is not public yet.
Star History
Last modified: August 10, 2025. Built with Franklin.jl