Rev | Line | |
---|
[37] | 1 | function f = flops(fl)
|
---|
| 2 | % FLOPS Get or set the global flopcount variable.
|
---|
| 3 | % FLOPS returns the current flopcount.
|
---|
| 4 | % FLOPS(F) sets flopcount to F.
|
---|
| 5 | %
|
---|
| 6 | % 0 flops: -x ' repmat
|
---|
| 7 | % 1 flop each: + - .*
|
---|
| 8 | % 2 flops each: < > == ~=
|
---|
| 9 | % For complex numbers, + is 2 flops, * is 6 flops.
|
---|
| 10 | % col_sum(x) takes (rows(x)-1)*cols(x) flops (use FLOPS_COL_SUM).
|
---|
| 11 | % row_sum(x) takes rows(x)*(cols(x)-1) flops (use FLOPS_ROW_SUM).
|
---|
| 12 | % Use FLOPS_DIV for ./
|
---|
| 13 | % Use FLOPS_RANDNORM for randn
|
---|
| 14 | % Use FLOPS_SQRT for sqrt
|
---|
| 15 | % Use FLOPS_POW for .^
|
---|
| 16 | % Use FLOPS_EXP for exp
|
---|
| 17 | % Use FLOPS_LOG for log, sin, and other special functions.
|
---|
| 18 | %
|
---|
| 19 | % See FLOPS_MUL, FLOPS_SOLVE, FLOPS_INV, FLOPS_CHOL, FLOPS_DET, ...
|
---|
| 20 |
|
---|
| 21 | global flopcount;
|
---|
| 22 | if nargin == 1
|
---|
| 23 | flopcount = fl;
|
---|
| 24 | if nargout == 1
|
---|
| 25 | f = fl;
|
---|
| 26 | end
|
---|
| 27 | else
|
---|
| 28 | f = flopcount;
|
---|
| 29 | end
|
---|
Note: See
TracBrowser
for help on using the repository browser.