ApasScript.

Tensors

tensor

A tensor from its shape and its entries in row-major order (rank up to 4). A matrix or an array is accepted wherever a tensor is.

zeroTensor

The all-zero tensor of a given shape.

kroneckerDelta

The identity tensor delta_ij of dimension n.

leviCivita

The Levi-Civita (permutation) symbol epsilon of dimension n.

euclideanMetric

The Euclidean metric of dimension n (the identity).

minkowskiMetric

The Minkowski metric diag(-1, 1, 1, 1).

rank

The number of indices of a tensor.

tensorGet

One entry, by a list of indices (from 0).

outer

The outer (tensor) product a (x) b.

contract

Contracts axis axA of a with axis axB of b (a generalized dot product).

contractSelf

Contracts two axes of one tensor.

tensorTrace

The trace over two axes, as a number.

doubleContract

A : B, the sum of a_ij b_ij.

transpose

Reverses the order of all axes (the transpose of a matrix).

transposeAxes

Swaps two axes.

symmetrize

The symmetric part (T + T^T)/2 of a rank-2 tensor.

antisymmetrize

The antisymmetric part (T - T^T)/2 of a rank-2 tensor.

invertMetric

The inverse metric g^ij of a metric g_ij.

raiseIndex

Raises the first index of t with the metric g.

lowerIndex

Lowers the first index of t with the metric g.

reshape

The same entries with a new shape (same total size).

tensorSlice

The sub-tensor with axis ax fixed at index k.