MATLAB Functions Help Desk

flops

Purpose

Count floating-point operations

Syntax

Description

f = flops returns the cumulative number of floating-point operations.

flops(0) resets the count to zero.

Examples

If A and B are real n-by-n matrices, some typical flop counts for different operations are

Operation

Flop Count

A+B

n^2

A*B

2*n^3

A^100

99*(2*n^3)

lu(A)

(2/3)*n^3

:

MATLAB's version of the LINPACK benchmark is:

Algorithm

It is not feasible to count all the floating-point operations, but most of the important ones are counted. Additions and subtractions are each one flop if real and two if complex. Multiplications and divisions count one flop each if the result is real and six flops if it is complex. Elementary functions count one if real and more if complex.



[ Previous | Help Desk | Next ]