multiTimes

PURPOSE ^

Matrix multiply each submatrix of two 3D arrays without looping.

SYNOPSIS ^

function C = multiTimes( A, B, type )

DESCRIPTION ^

 Matrix multiply each submatrix of two 3D arrays without looping.

 type controls the matrix multiplication to perform (for each i):
  1    - C(:,:,i) = A(:,:,i)*B(:,:)
  1.1  - C(i,:,:) = A(:,:,i)*B(:,:)
  1.2  - C(:,:,i) = A(:,:)*B(:,:,i)
  2    - C(:,:,i) = A(:,:,i)*B(:,:,i)
  2.1  - C(:,:,i) = A(:,:,i)'*B(:,:,i)
  2.2  - C(:,:,i) = A(:,:,i)*B(:,:,i)'
  3    - C(:,i) = A(:,:,i)*B(:,i)
  3.1  - C(:,i) = A(:,:,i)'*B(:,i)
  3.2  - C(:,i) = A(:,i)'*B(:,:,i)
  4.1  - C(i) = trace(A(:,:,i)'*B(:,:,i))
 Corresponding dimensions of A and B must match appropriately.

 USAGE
  C = multiTimes( A, B, type )

 INPUTS
  A         - [ma x na x oa] matrix
  B         - [mb x nb x ob] matrix
  type      - multiplication type (see above)

 OUTPUTS
  C         - result of the multiplication

 EXAMPLE
  n=10000; A=randn(2,2,n); B=randn(2);
  tic, C1=multiTimes(A,B,1); toc
  tic, C2=zeros(size(A)); for i=1:n, C2(:,:,i)=A(:,:,i)*B; end; toc

 See also BSXFUN, MTIMES

 Piotr's Computer Vision Matlab Toolbox      Version 2.52
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]

Generated by m2html © 2003