Home > Applications > SpinW > external > mmat.m

iFit/mmat

PURPOSE ^

Simple matrix multiplication of multidimensional arrays.

SYNOPSIS ^

function C = mmat(A,B,dim)

DESCRIPTION ^

 Simple matrix multiplication of multidimensional arrays.

 Input:
 A, B      Multidimensional input arrays.
 dim       Contains two number, that selects two dimensions.

 The multiplication is a standard matrix multiplication. The two matrices
 are selected by dim:
   AB = A(... dim(1) ... dim(2) ...) * B(... dim(1) ... dim(2) ...)
 The necessary condition that the multiplication can be performed:
   size(A,dim(2)) = size(B,dim(1))

 Singleton dimensions in both A and B matrices are supported.

 The default value for dim is dim = [1 2].

 Examples:
 For 2D matrices mmat is identical to the Matlab built-in multiplication:
 A = [1 2 3 4];
 B = [1;2;3;4];
 C = mmat(A,B)

 C will be 30.

 For multidimensional arrays:
 A = repmat([1 2 3 4],[1 1 5]);
 B = [1 2 3 4]';
 C = mmat(A,B)
 C will be an array with dimensions of 1x1x5 and every element is 30.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Mon 26-Nov-2018 15:08:42 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1