source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/flops_spmul.m @ 37

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

Added original make3d

File size: 420 bytes
Line 
1function 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
10nza = (a ~= 0);
11nzb = (b ~= 0);
12f = nza*nzb;
13f = 2*f - (f ~= 0);
14f = sum(sum(f));
Note: See TracBrowser for help on using the repository browser.