source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/test_ndsum.m @ 86

Last change on this file since 86 was 37, checked in by (none), 15 years ago

Added original make3d

File size: 594 bytes
Line 
1x = rand([2 3 4]);
2maxdiff(ndsum(x,[1 3]),ndsumC(x,[1 3]))
3
4if 1
5  % special cases
6  maxdiff(ndsum(x,1:3),ndsumC(x,1:3))
7  maxdiff(ndsum(x,[]),ndsumC(x,[]))
8end
9
10tim = [];
11for 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;
19end
20figure(1)
21clf
22plot(tim)
23xlabel('trial')
24ylabel('time (sec)')
25%legend('ndsum', 'ndsumC', 'sum', 2)
26legend('ndsum', 'ndsumC', 2)
27axis_pct
Note: See TracBrowser for help on using the repository browser.