annotate 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 |
|
rev |
line source |
samer@4
|
1 function C=mapinner(A,B)
|
samer@4
|
2 % mapinner - inner product for multidim arrays
|
samer@4
|
3 %
|
samer@4
|
4 % mapinner :: [[N,M]], [[M,L]] -> [[N,L]].
|
samer@4
|
5 %
|
samer@4
|
6 % This is like matrix multiplication except that the N and L
|
samer@4
|
7 % can stand for multiple dimensions, ie inputs can be more
|
samer@4
|
8 % than 2-dimensional arrays.
|
samer@4
|
9
|
samer@4
|
10 Adom=size(A);
|
samer@4
|
11 Bdom=size(B);
|
samer@4
|
12
|
samer@4
|
13 A=reshape(A,[],Bdom(1));
|
samer@4
|
14 B=reshape(B,Bdom(1),[]);
|
samer@4
|
15 C=reshape(A*B,[Adom(1:end-1) Bdom(2:end)]);
|
samer@4
|
16
|