Main Content

noperations

Number of quantization operations by quantizer object

Description

a = noperations(q) returns the number of quantization operations during a call to quantize(q,...) for quantizer object q. This value accumulates over successive calls to quantize. You reset the value of noperations to zero by issuing the command reset(q) or resetlog(q).

example

Examples

collapse all

Create a default quantizer object, use it to quantize a vector of values, then return the number of quantization operations performed by the quantizer object.

q = quantizer;
y = quantize(q,-20:10);
noperations(q)
Warning: 29 overflow(s) occurred in the fi quantize operation. 
> In embedded.quantizer/quantize (line 81) 

ans =

    31

Input Arguments

collapse all

Input quantizer object.

Example: q = quantizer

Algorithms

Each time any data element is quantized, noperations is incremented by one. The real and complex parts are counted separately. For example, (complex*complex) counts four quantization operations for products and two for sum, because(a+bi)*(c+di) = (a*c - b*d) + (a*d + b*c). In contrast, (real*real) counts one quantization operation.

In addition, the real and complex parts of the inputs are quantized individually. As a result, for a complex input of length 204 elements, noperations counts 408 quantizations: 204 for the real part of the input and 204 for the complex part.

If any inputs, states, or coefficients are complex-valued, they are all expanded from real values to complex values, with a corresponding increase in the number of quantization operations recorded by noperations. In concrete terms, (real*real) requires fewer quantizations than (real*complex) and (complex*complex). Changing all the values to complex because one is complex, such as the coefficient, makes the (real*real) into (real*complex), raising noperations count.

Version History

Introduced before R2006a