annotate general/numerical/proddims.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 A=proddims(A,dims)
|
samer@4
|
2 % proddims - Product over multiple dimensions
|
samer@4
|
3 %
|
samer@4
|
4 % proddims ::
|
samer@4
|
5 % [Size:[[1,E]]->A] ~'E dimensional array',
|
samer@4
|
6 % Dims:[[K]->1..E] ~'dims to prod over'
|
samer@4
|
7 % -> [Size1->A] :- Size1=arrset(Size,Dims,1).
|
samer@4
|
8 %
|
samer@4
|
9 % Result is same size as input except for summed dimensions
|
samer@4
|
10 % which are collapsed to a size of 1.
|
samer@4
|
11 for i=dims, A=prod(A,i); end
|