Skip to content

Tensor algebra

Definitions and identities of the products TensND implements. Index formulas are those of the OMEinsum contraction codes in src/array_utils.jl; the algebraic identities follow the Echoes manual appendix on tensor algebra.

Components below are written in an orthonormal frame so that index position carries no extra information; the general, variance-aware statement is on Bases and variance.

Tensor products

For of order and of order , the tensor product is the order-  tensor

The symmetrized tensor product symmetrizes over the last index of and the first of :

so that for two vectors

Box products

Two order-2 tensors combine into an order-4 tensor in two further ways, which are what make the order-4 identity and the deviatoric projector expressible in closed form:

TensND also exposes the intermediate otimesl, with   , from which is the half-sum.

With the order-2 identity, the two order-4 identities are

is the identity of the space of all order-2 tensors, that of the symmetric ones — which is the one tens_Id4 returns, since every symmetry class in this library lives in the minor-symmetric subspace.

Contractions

OperationDefinitionResulting order
    
    
    

Each consumes the last indices of the left operand against the first of the right one — see the warning on Notation about the competing double-contraction convention.

Between two order-4 tensors, is the Frobenius scalar product

and it is this scalar product that every projection in Projection onto a symmetry class minimizes against.

Transpose of an order-4 tensor

Consistently with the pair-wise double contraction, the transpose exchanges the two index pairs:

A tensor with   is major-symmetric; one with    is minor-symmetric. The two are independent, and the distinction decides how many coefficients a symmetry class needs — five against six for transverse isotropy (Walpole basis), nine against twelve for orthotropy (Orthotropy).

Identities

The following hold for order-2 and are what allow the structured types to compute products and inverses in closed form rather than by expanding 81 components:

The symmetrized box product does not invert termwise

Identity (e) has no counterpart for :

Equality requires and to be proportional,   , in which case the scalar cancels between the two factors. Commuting is not enough: two distinct diagonal tensors commute, yet their symmetrized box product still fails to invert termwise. Nor does taking   help.

This is why inversion is implemented per symmetry class — closed forms on the pair, on the Walpole triplet, or on the orthotropic block — rather than through one generic formula.

Note also that inverts and acts as an identity only on symmetric order-2 tensors:   is the symmetric part of , whereas    for every .

Symbolic and numerical evaluation

All of the above is implemented once, generically, on AbstractArrays through OMEinsum contraction codes, and therefore applies unchanged to Float64, ForwardDiff.Dual, SymPy.Sym and Symbolics.Num element types. The structured types (TensISO, TensTI, TensOrtho) override the generic route with closed forms whenever the result stays in the class — see Structured tensors.