tmulttakes a minimum of two arguments which are the tensors on which the multiplication operation is to be performed.
With no additional arguments,
tmultwill 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
y[c]z:tmult(x,y);⇒ z[a,b,c] = x[a,b]*y[c]
With an additional argument,
tmultwill produce the inner product of the two tensors on the specified index. For example, given
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
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,
tmultproduces an inner product of the two tensors on the specified indices. For example, for
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.