MATMULT Matrix multiplication for arrays of matrices. Often we wish to form the matrix product A*B for two matrices A and B. MATMULT performs matrix multiplication for arrays of such matrices. Let A be an array of K different M x N matrices, and similarly let B be an array of K different N x P matrices. C=MATMULT(A,B,DIM) returns an array of the K products CK=AK*BK, where DIM gives the dimension in A on which the M x N matrix begins. Thus A, B, and C have the following dimensions DIM | A -- K1 x K2 x ... x M x N x ... x KN B -- K1 x K2 x ... x N x P x ... x KN C -- K1 x K2 x ... x M x P x ... x KN The usual matrix multiplication is then C=MATMULT(A,B,1). A and B can have any dimensionality so long as the dimensions containing the matrices are adjacent to each other. See also VECTMULT. 'matmult --t' runs some tests. Usage: matc=matmult(mata,matb,dim); _________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2004--2015 J.M. Lilly --- type 'help jlab_license' for details