✦ For everyone, free.

Practical knowledge for real and everyday life

Home

2.15.5 Tensor Finite Computation Context

Tensor Finite Computation Context explores structured algebraic operations on tensors, enabling efficient finite-dimensional computations within formal mathematics.

Tensor Finite Computation Context is the practical setting in which tensors over finite-dimensional vector spaces are represented, manipulated, and evaluated using explicit numerical arrays and index-based algorithms, encompassing the storage schemes, arithmetic operations, and complexity considerations that arise when a type (p, q) tensor must be turned into something a computation can actually carry out. Where the formal definition of a tensor treats it as an abstract multilinear object or an element of an abstract tensor product space, the computational context treats it as an n-dimensional array of numbers indexed by p + q integers, together with well-defined rules for combining such arrays.


Array Representation

From Abstract Tensor to Concrete Array

Once a basis e_1, ..., e_n of V is fixed, a type (p, q) tensor T is represented by its component array T^{i_1...i_p}_{j_1...j_q}, a table of n^{p+q} scalars indexed by p upper indices and q lower indices, each ranging from 1 to n. This array is what gets stored in memory as a multidimensional array, and every abstract tensor operation must be translated into an explicit rule for producing new arrays from old ones.

Storage Layout

Because a computer's memory is linearly addressed, a multidimensional component array must be flattened into a sequence, typically using row-major or column-major ordering, where the position of an entry with indices (i_1, ..., i_p, j_1, ..., j_q) is computed by a fixed formula involving the dimension n and the rank p + q. The choice of layout affects the efficiency of operations that access the array along different index directions, since contiguous memory access is faster than strided access.


Core Operations and Their Cost

Basis Transformation

Changing basis on V requires applying a transformation matrix A once for each contravariant index and its inverse once for each covariant index, following the standard tensor transformation law. Computed directly, this costs n multiply-add operations for each of the n^{p+q} output components and each of the p + q indices being transformed, giving a total cost on the order of n to the power p + q + 1, multiplied by p + q.

cost p+q np+q+1

Tensor Contraction

Contracting a tensor over a pair of matching indices, one upper and one lower, sums the array over that shared index while leaving the remaining p + q - 2 indices free. A direct implementation costs one multiply-add per value of the contracted index for each of the n^{p+q-2} remaining component slots, giving a total operation count of order n^{p+q-1}, since the contracted dimension contributes one extra factor of n inside the sum.

Tensor Product of Two Tensors

Forming the tensor product of a type (p_1, q_1) tensor and a type (p_2, q_2) tensor produces a type (p_1+p_2, q_1+q_2) tensor whose component array is the outer product of the two input arrays. The resulting array has n^{p_1+q_1+p_2+q_2} entries, each obtained by a single multiplication, so the cost is dominated by the size of the output rather than any nontrivial per-entry work.


Einstein Summation as a Computational Convention

Implicit Summation Notation

In the finite computational context, repeated indices appearing once as an upper index and once as a lower index within a single term are, by the Einstein summation convention, implicitly summed over their full range without an explicit summation symbol. This convention is directly implementable as a nested loop structure, where each repeated index becomes a loop that accumulates into the result, and it underlies the design of tensor computation libraries that accept an index expression string and derive the corresponding array contraction automatically.

Ci = Aji Bj

This expression denotes, for each value of the free index i, a sum over j from 1 to n of the product A^i_j B^j, which is exactly the matrix-vector product when A is viewed as a type (1, 1) tensor and B as a type (1, 0) tensor.


Diagram of Index Contraction

A[i,j] j B[j] C[i] Shared index j is summed over, leaving only the free index i.

The diagram shows the shared index j acting as the contraction channel between two arrays, collapsed by summation to leave the free index i in the output array, mirroring the loop structure a direct implementation would use.


Practical Consequences of Finiteness

Predictable Cost Bounds

Because the underlying dimension n and rank p + q are both finite and fixed, every operation in this context has a computable, bounded operation count and memory footprint, expressed as an explicit power of n. This predictability is what allows tensor computation libraries to preallocate exact array sizes and to reason about algorithmic complexity purely in terms of n and the ranks involved, without the convergence or approximation concerns that arise once dimension becomes infinite.