1function f = luflop (L, U)						    %#ok
2%LUFLOP given L and U, computes # of flops required to compute them
3%
4% Example:
5% f = luflop (L, U)
6%
7% Given an LU factorization, compute how many flops took to compute it.  This
8% is the same as (assuming U has a zero-free diagonal):
9%
10%   Lnz = full (sum (spones (L))) - 1 ;
11%   Unz = full (sum (spones (U')))' - 1 ;
12%   f = 2*Lnz*Unz + sum (Lnz) ;
13%
14% except that no extra workspace is allocated for spones (L) and spones (U).
15% L and U must be sparse.
16%
17% Note: the above expression has a subtle undercount when exact numerical
18% cancelation occurs.  Try [L,U,P] = lu (sparse (ones (10))) and then
19% luflop (L,U).
20%
21% See also LU
22
23% Copyright 1995-2009 by Timothy A. Davis.
24
25help luflop
26error ('luflop mexFunction not found!  Use umfpack_make to compile luflop.') ;
27