Tensorial.jl
Introduction
Tensorial.jl provides a statically sized Tensor type compatible with AbstractArray, similar to SArray from StaticArrays.jl, together with a tensorial interface for concise and efficient computations.
In addition to basic AbstractArray operations, Tensorial.jl supports tensor symmetries through @Symmetry, allowing adjacent groups of indices to be treated symmetrically. These symmetries are consistently respected in tensor operations such as contraction, inversion, and automatic differentiation, reducing unnecessary computations while preserving the intended tensor structure.
Key features of Tensorial.jl include:
- Contraction, tensor product (
⊗), and a flexible@einsummacro for Einstein summation - A
@Symmetrymacro for defining tensor symmetries on adjacent index groups, consistently respected in tensor operations and automatic differentiation - Automatic differentiation via
∂,gradient, andhessian, leveraging ForwardDiff.jl - Direct sums for mixed tensor and scalar variables, preserving block structure in differentiation and linear algebra
- Performance comparable to
SArray(see benchmarks)
Installation
pkg> add TensorialOther tensor packages
Inspiration
Some functionalities are inspired from the following packages: