Tensor Rank
1. Tensor Rank (Order)
Formal Definition:
The rank (or order) of a tensor is the number of independent directional components required to specify the tensor completely. Alternatively, it's the number of indices needed in the component representation.
Mathematical Form:
Examples:
Temperature: T = 298K
Mass: m = 5kg
Pressure: P = 101.3 kPa
Energy: E = 10J
2. Classification by Rank
Rank 0 (Scalars)
Definition: Single numbers, no directional components
Mathematical Form:
Examples:
Temperature: T = 298K
Mass: m = 5kg
Pressure: P = 101.3 kPa
Energy: E = 10J
Rank 1 (Vectors)
Definition: One directional component
Mathematical Form:
Examples:
Position vector:
Velocity:
Force:
Electric field:
Rank 2 (Matrices)
Definition: Two directional components
Mathematical Form:
Examples:
Stress Tensor:
Inertia tensor:
Metric tensor:
Rank 3
Definition: Three directional components
Mathematical Form:
Examples:
Piezoelectric tensor:
Levi-Civita Symbol:
3. Mathematical Operations by Rank
3.1 Rank Addition
Rank addition for tensors refers to the process of adding tensors with different ranks, resulting in a higher-rank tensor. In the context of tensors, rank (or order) refers to the number of dimensions (or axes) in the tensor.
When adding tensors of different ranks, one of two main techniques is typically used:
1. Broadcasting:
Broadcasting is a technique where lower-rank tensors are expanded to match the dimensions of higher-rank tensors during an operation like addition.
For example, if we have a rank-2 tensor (a matrix) and add it to a rank-1 tensor (a vector), the rank-1 tensor can be “broadcast” to match the rank-2 shape.
Suppose a rank-2 tensor has a shape of 3x3, and a rank-1 tensor has a shape of 3. Broadcasting replicates the rank-1 tensor across each row or column, allowing element-wise addition to occur.
2. Tensor Stacking:
Stacking is a method where tensors of the same shape are combined along a new axis, increasing the rank by one.
For instance, stacking two matrices (rank-2 tensors) of shape 3x3 results in a rank-3 tensor of shape 2x3x3. This is useful in cases where we want to preserve each tensor independently within a higher-rank structure, rather than perform element-wise addition.
Key Points
Broadcasting efficiently aligns shapes, enabling element-wise operations between tensors of different ranks without needing explicit expansion of the lower-rank tensor.
Stacking maintains individual tensor elements but increases rank, as it adds a new dimension.
Same rank tensors can be added:
Vectors (Rank 1):
Matrices (Rank 2):
Rank Addition with Broadcasting
Consider a rank-1 tensor (vector) and a rank-2 tensor (matrix) M:
Using broadcasting, can be added to each row of as follows:
3.2 Rank Multiplication
Vector × Vector → Scalar (Rank reduction):
Vector × Vector → Matrix (Rank increase):
Matrix × Vector → Vector:
4. Rank Change Operations
Rank multiplication for tensors involves performing multiplication operations between tensors of varying ranks, often resulting in a higher-rank tensor. The type of multiplication can vary depending on the application and can include operations such as element-wise multiplication, outer products, or tensor contractions.
1. Element-wise Multiplication:
Also known as the Hadamard product, element-wise multiplication occurs when tensors of the same shape (and thus the same rank) are multiplied. Each element in one tensor is multiplied by the corresponding element in the other tensor.
Example: For two rank-2 tensors (matrices) A and B of shape 2x2 , the element-wise multiplication results in
2. Outer Product:
The outer product of two tensors of ranks and produces a tensor of rank . This is often used to create higher-dimensional tensors by combining lower-dimensional ones.
Example: For a rank-1 tensor and another rank-1 tensor ,
Here, the result is a rank-2 tensor (matrix) with shape 3x2.
3. Tensor Contraction (Generalized Inner Product):
Tensor contraction is similar to matrix multiplication but extends to tensors of higher ranks. It involves summing over specific indices in a pair of tensors, effectively reducing the total rank.
For example, contracting a rank-3 tensor A of shape 2x3x4 with a rank-2 tensor B of shape 4x5 over the last index of A and the first index of B results in a rank-3 tensor of shape 2x3x5.
4. Matrix Multiplication:
Matrix multiplication is a specific type of rank multiplication between two rank-2 tensors (matrices). In this operation, the number of columns in the first matrix must equal the number of rows in the second. The result is a new rank-2 tensor (matrix).
Example: For matrices C and D where C is 2x3 and D is 3x2,
Key Points
Rank Addition and Rank Multiplication often lead to different dimensional results. Rank addition typically preserves the rank, while rank multiplication can increase or decrease it.
These operations are integral in fields like deep learning, where tensors of varying ranks are manipulated in complex models like neural networks.
5. Properties Based on Rank
5.1 Component Count
In 3D space:
Rank 0: 1 component
Rank 1: 3 components
Rank 2: 9 components
Rank 3: 27 components
Rank 4: 81 components
5.2 Symmetry Properties
Symmetric Rank 2: A tensor is symmetric if it satisfies: This property means that swapping the indices does not change the value.
Antisymmetric Rank 2: A tensor is antisymmetric if it satisfies: In this case, swapping the indices negates the value.
Cyclic Rank 3: A tensor is cyclic if it satisfies: This means that rotating the indices in a cyclic manner yields the same value.
Last updated