source:
proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/flops_spmul.m
@
177
Last change on this file since 177 was 37, checked in by , 15 years ago | |
---|---|
File size: 420 bytes |
Line | |
---|---|
1 | function f = flops_spmul(a,b) |
2 | % FLOPS_SPMUL Flops for sparse matrix multiplication. |
3 | % FLOPS_SPMUL(a,b) returns the number of flops for a*b, where multiplication |
4 | % and addition of zero doesn't count. |
5 | % For example: |
6 | % flops_spmul(0,4) is 0. |
7 | % flops_spmul([1 0 1], [2;3;4]) is 3. |
8 | % flops_spmul(eye(3), [2;3;4]) is 3. |
9 | |
10 | nza = (a ~= 0); |
11 | nzb = (b ~= 0); |
12 | f = nza*nzb; |
13 | f = 2*f - (f ~= 0); |
14 | f = sum(sum(f)); |
Note: See TracBrowser
for help on using the repository browser.