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

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

Added original make3d

File size: 516 bytes
Line 
1function f = flops_chol(n)
2% FLOPS_CHOL    Flops for Cholesky decomposition.
3% FLOPS_CHOL(n) returns the number of flops for chol(eye(n)).
4
5% Formula comes from Numerical Recipes algorithm.
6% Number of multiplies+adds is:
7% sum(i=1..n) sum(j=i..n) sum(k=i-1..1) 2 = sum(i=1..n) 2*(n-i+1)*(i-1)
8% = (n^3-n)/3 = maple('simplify(sum(2*(n-x+1)*(x-1),x=1..n));')
9% Number of divides is:
10% sum(i=1..n) (n-i+1) - n = (n^2-n)/2
11
12% matlab5 counts n^3/3 only
13f = (n.^3-n)/3 + (n.^2-n)/2*flops_div + n*flops_sqrt;
Note: See TracBrowser for help on using the repository browser.