Line | |
---|
1 | x = rand([2 3 4]);
|
---|
2 | maxdiff(ndsum(x,[1 3]),ndsumC(x,[1 3]))
|
---|
3 |
|
---|
4 | if 1
|
---|
5 | % special cases
|
---|
6 | maxdiff(ndsum(x,1:3),ndsumC(x,1:3))
|
---|
7 | maxdiff(ndsum(x,[]),ndsumC(x,[]))
|
---|
8 | end
|
---|
9 |
|
---|
10 | tim = [];
|
---|
11 | for k = 1:3
|
---|
12 | sz = repmat(10*k,1,5);
|
---|
13 | x = rand(sz);
|
---|
14 | niter = floor(20/k);
|
---|
15 |
|
---|
16 | %tic; for i = 1:niter sum(x,4); end; tim(k,3) = toc;
|
---|
17 | tic; for i = 1:niter ndsum(x,[2 4]); end; tim(k,1) = toc;
|
---|
18 | tic; for i = 1:niter ndsumC(x,[2 4]); end; tim(k,2) = toc;
|
---|
19 | end
|
---|
20 | figure(1)
|
---|
21 | clf
|
---|
22 | plot(tim)
|
---|
23 | xlabel('trial')
|
---|
24 | ylabel('time (sec)')
|
---|
25 | %legend('ndsum', 'ndsumC', 'sum', 2)
|
---|
26 | legend('ndsum', 'ndsumC', 2)
|
---|
27 | axis_pct
|
---|
Note: See
TracBrowser
for help on using the repository browser.