Next: , Previous: Matrix commands, Up: Matrices and Tensors


4.4 Tensors

The tensors supported by JACAL are an extension of the matrix structure (i.e., a bunch of bunches of bunches ...) with the added stipulation that all dimensions of the tensor be the same length (e.g., 4x4x4). The number of dimensions (indices) in a tensor is its rank: A scalar is a tensor of rank 0; a vector is a rank 1 tensor; a matrix has rank 2; and so on.

Further, just as matrix binary operations place restrictions on the matrices involved (e.g., the row/column length requirement for matrix multiplication), the tensor binary operations require that the dimensions of each tensor be of the same length. For example, you could not multiply a 3x3 tensor and a 4x4x4 tensor.

JACAL's tensors do not support the construct of contravariant and covariant indices. Users must keep track of this information themselves, and perform the necessary operations with an appropriate metric so that the "index gymnastics" is performed correctly.

Before using any of JACAL's tensor operations, execute the following command from the JACAL prompt:

require("tensor");

This loads the file tensor.scm into JACAL, and makes the tensor operations available for use.

JACAL currently supports four tensor operations: tmult, contract, indexshift, and indexswap. Each of these is described in detail below.