carten.spad line 85 [edit on github]
CartesianTensor(minix, dim, R) provides Cartesian tensors with components belonging to a commutative ring R. These tensors can have any number of indices. Each index takes values from minix to minix + dim - 1.
s*t is the inner product of the tensors s and t which contracts the last index of s with the first index of t, i.e. t*s = contract(t, rank t, s, 1) t*s = sum(k=1..N, t[i1, .., iN, k]*s[k, j1, .., jM]) This is compatible with the use of M*v to denote the matrix-vector inner product.
coerce(v) views a vector as a rank 1 tensor.
coerce([t_1, ..., t_dim]) allows tensors to be constructed using lists.
coerce([r_1, ..., r_dim]) allows tensors to be constructed using lists.
coerce(m) views a matrix as a rank 2 tensor.
contract(t, i, s, j) is the inner product of tenors s and t which sums along the k1-th index of t and the k2-th index of s. For example, if r = contract(s, 2, t, 1) for rank 3 tensors rank 3 tensors s and t, then r is the rank 4 (= 3 + 3 - 2) tensor given by r(i, j, k, l) = sum(h=1..dim, s(i, h, j)*t(h, k, l)).
contract(t, i, j) is the contraction of tensor t which sums along the i-th and j-th indices. For example, if r = contract(t, 1, 3) for a rank 4 tensor t, then r is the rank 2 (= 4 - 2) tensor given by r(i, j) = sum(h=1..dim, t(h, i, h, j)).
elt(t) gives the component of a rank 0 tensor.
elt(t, i) gives a component of a rank 1 tensor.
elt(t, i, j) gives a component of a rank 2 tensor.
elt(t, i, j, k) gives a component of a rank 3 tensor.
elt(t, i, j, k, l) gives a component of a rank 4 tensor.
elt(t, [i1, ..., iN]) gives a component of a rank N tensor.
kroneckerDelta() is the rank 2 tensor defined by kroneckerDelta()(i, j) = 1if i = j = 0 ifi = j
leviCivitaSymbol() is the rank dim tensor defined by leviCivitaSymbol()(i1, ...idim) = +1/0/-1 if i1, ..., idim is an even/is nota /is an odd permutation of minix, ..., minix+dim-1.
product(s, t) is the outer product of the tensors s and t. For example, if r = product(s, t) for rank 2 tensors s and t, then r is a rank 4 tensor given by r(i, j, k, l) = s(i, j)*t(k, l).
rank(t) returns the tensorial rank of t (that is, the number of indices). This is the same as the graded module degree.
ravel(t) produces a list of components from a tensor such that unravel(ravel(t)) = t.
reindex(t, [i1, ..., idim]) permutes the indices of t. For example, if r = reindex(t, [4, 1, 2, 3]) for a rank 4 tensor t, then r is the rank for tensor given by r(i, j, k, l) = t(l, i, j, k).
sample() returns an object of type %.
transpose(t) exchanges the first and last indices of t. For example, if r = transpose(t) for a rank 4 tensor t, then r is the rank 4 tensor given by r(i, j, k, l) = t(l, j, k, i).
transpose(t, i, j) exchanges the i-th and j-th indices of t. For example, if r = transpose(t, 2, 3) for a rank 4 tensor t, then r is the rank 4 tensor given by r(i, j, k, l) = t(i, k, j, l).
unravel(t) produces a tensor from a list of components such that unravel(ravel(t)) = t.
GradedAlgebra(R, NonNegativeInteger)