CErrorCalc Documentation

using namespace CErrorCalc;

typedef unsigned int UINT;

Public Namespace Classes

ErrorCalcOptions
class ErrorCalcOptions
{
public:
    ErrorCalcOptions() : discard(true) { }; // default constructor
                                            // sets the default values
                                            // for the options

    bool discard;                           // true - CErrorCalc will discard
                                            // values out of the max_error_range
                                            // delta = (max - min) / 2;
                                            // max_error_range = (avg - delta ; avg + delta)
};

Public Functions

CErrorCalc(const char*);

The first of the three constructors available. It will read the data from a string in memory. The values can be separated by ',' or new lines.

CErrorCalc(float**, UINT);

This constructor will use an array of floats to read the data. The second argument is the number of values in the array.

CErrorCalc(FILE*);

Finally this one will read the values from an open file handle. Inside the file the values should be separeted by ',' or new lines. The constructor will close the file after reading.

~CErrorCalc();

This is the deconstructor. Frees memory, closes file handles, etc.

void PrintVerboseInfo();

This is mostly a debug function. When called it will print all the data it holds to stdout separating each value with a new line.

void SetOptions(ErrorCalcOptions options);

This function is used to set options inside the class. The first and only argument is a ErrorCalcOptions class filled with the proper options you want to set.

void eval();

In order to be able to give you the values of the standard deviation delta and others, the CErrorCalc object must first perfom a series of calculations. Normaly they will be done once they are needed (when you call getErrorStd(), getErrorDelta() or getAverage()), but you can have all these values computed when you choose by calling this function.

UINT getDiscarded();

This function will return the total number of discarded values. If discarding values is disabled zero is returned. This depends on the average value. All dependencies will be calculated first.

UINT getTotal();

This will return the total number of values that are stored by the class. This depends on the average value. All dependencies will be calculated first.

float getAverage();

Returns the average value.

float getErrorDelta();

Returns the average deviation delta computed based on the equation:

(|avg - x(1)| + |avg - x(2)| + ... + |avg - x(n -1)| + |avg - x(n)|) / n

This depends on the average value. All dependencies will be calculated first.

float getErrorStd();

Return the standard deviation delta computed based on the equation:

sqrt(((avg - x(1))^2 + (avg - x(2))^2 + ... + (avg - x(n-1))^2 + (avg - x(n))^2) / n)

This depends on the average value. All dependencies will be calculated first.

Namespace Functions

static float MakeUnsigned(float input);

A small helper function. Will return the based on this formula:

input >= 0         return input;
input < 0          return -input;

"People sleep peacefully in their beds at night only because rough men stand ready to do violence on their behalf."

Last update: Wednesday, 11th October, 2023
Copyright © 2001-2024 by Lukasz Tomicki