Next: Tensor contraction, Previous: Tensors, Up: Matrices and Tensors [Contents][Index]

- Command:
**tmult***matrix_1 matrix_2 index_1 index_2*¶ `tmult`

takes a minimum of two arguments which are the tensors on which the multiplication operation is to be performed.With no additional arguments,

`tmult`

will produce the outer product of the two input tensors. The rank of the resulting tensor is the sum of the inputs’ ranks, and the components of the result are formed from the pair-wise products of components of the inputs. For example, for the input tensors`x[a,b]`

and`y[c]`

z:tmult(x,y); ⇒ z[a,b,c] = x[a,b]*y[c]

With an additional argument,

`tmult`

will produce the inner product of the two tensors on the specified index. For example, given`x[i,j]`

and`y[k,l,m]`

z:tmult(x,y,3); ⇒ length ----- \ z[a,b,c] = > x[a,q] * y[b,c,q] / ----- q = 1

Note that in this case

`x`only has 2 indices. All of JACAL’s tensor operations modify index inputs to be between 1 and the rank of the tensor. Thus, in this example, the 3 is modified to 2 in the case of`x`. As another example, with`x[i,j,k]`

and`y[l,m,n]`

z:tmult(x,y,2); ⇒ length ----- \ z[a,b,c,d] = > x[a,q,b] * y[c,q,d] / ----- q = 1

With four arguments,

`tmult`

produces an inner product of the two tensors on the specified indices. For example, for`x[i,j]`

and`y[k,l,m]`

z:tmult(x,y,1,3); ⇒ length ----- \ z[a,b,c] = > x[q,a] * y[b,c,q] / ----- q = 1

Note that matrix multiplication is the special case of an inner product (of two "two dimensional matrices") on the second and first indices, respectively:

`tmult(x,y,2,1) ≡ ncmult(x,y)`

Finally, tmult handles the case of a scalar times a tensor, in which case each component of the tensor is multiplied by the scalar.

Next: Tensor contraction, Previous: Tensors, Up: Matrices and Tensors [Contents][Index]