view general/numerical/mapinner.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents e44f49929e56
children
line wrap: on
line source
function C=mapinner(A,B)
% mapinner - inner product for multidim arrays
%
% mapinner :: [[N,M]], [[M,L]] -> [[N,L]].
%
% This is like matrix multiplication except that the N and L
% can stand for multiple dimensions, ie inputs can be more
% than 2-dimensional arrays.

Adom=size(A);
Bdom=size(B);

A=reshape(A,[],Bdom(1));
B=reshape(B,Bdom(1),[]);
C=reshape(A*B,[Adom(1:end-1) Bdom(2:end)]);