Into

Modules

Documentation

classPiiMathematicalFunction

#include <PiiMathematicalFunction.h>

An operation that applies a mathematical function to its input.

Inherits PiiDefaultOperation

Description

Inputs

inputany scalar or matrix

Outputs

outputthe result of applying a mathematical function to the input. The output type depends both on the input and the function. For example, the absolute value for a complex number is real. The input type will be preserved whenever possible.

Properties

The function to apply.

Public types

enum
{ NoFunction, Abs, Log, Sqrt, Square, Sin, Cos, Tan, Var, Std, Mean }

Supported mathematical functions.

Constructors and destructor

Public member functions

void
( )

Protected member functions

virtual void

Executes one round of processing.

Property details

  • Function function

    [read, write]

    The function to apply.

    The default value is NoFunction.

Enumeration details

  • enum Function

    Supported mathematical functions.

    • NoFunction - just pass the input object

    Functions that will be applied element-wise to matrices and scalars:
    • Abs - absolute value. Output type equals input type for all but complex numbers.

    • Log - natural logarithm. Output type is double. Complex numbers cause run-time exception.

    • Sqrt - square root. Output type is double. Complex numbers cause run-time exception.

    • Square - square. Output type equals input type. Beware of overflows!

    • Sin - sine of angle. Output type is double except for float input, for which it is float. Complex numbers cause run-time exception.

    • Cos - cosine of angle. Output type is double except for float input, for which it is float. Complex numbers cause run-time exception.

    • Tan - tangent of angle. Output type is double except for float input, for which it is float. Complex numbers cause run-time exception.

    Functions that calculate a value over all elements in a matrix. In all these cases the output type is double. Scalars and complex-valued matrices as input cause run-time exception:
    • Var - variance

    • Std - standard deviation

    • Mean - mean

Function details

  • PiiMathematicalFunction

    ()
  • Function function

    ()
  • void setFunction

    ( )
  • virtual void process

    ()
    [protected, virtual]

    Executes one round of processing.

    This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.

    Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().

    Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns Running.

    Exceptions
    PiiExecutionException

    whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.

    Reimplemented from PiiDefaultOperation.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.