Mercurial > hg > ishara
comparison general/numerical/mouter.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:3f77126f7b5f | 4:e44f49929e56 |
---|---|
1 function B=mouter(varargin) | |
2 % mouter - Multidimensional outer product of multiple arrays | |
3 % Index domain of result is the concatenation of the index domains | |
4 % of the arguments, (with trailing 1s removed). | |
5 % | |
6 % mouter :: [Size1->A], [Size2->A] -> [[Size1,Size2]->A]. | |
7 % mouter :: [Size1->A], [Size2->A], [Size3->A] -> [[Size1,Size2,Size3]->A]. | |
8 % etc. | |
9 B=1; | |
10 for i=1:length(varargin) | |
11 B=kron(varargin{i},B); | |
12 end | |
13 B=reshape(B,cell2mat(cellmap(@size1,varargin))); | |
14 |