Qwt Programmer's Manual

QwtMath


NAME

QwtMath - a set of mathematical routines

SYNOPSIS

#include <qwtMath.h>

FUNCTIONS

qwtGetMin
Find the smallest value in an array
qwtGetMax
Find the largest value in an array
qwtTwistArray
invert the order of an array
qwtFloor125
Find the largest value fitting in a 1-2-5 pattern
qwtCeil125
Find the smallest value fitting in a 1-2-5 pattern
qwtChkMono
Check for monotony
qwtLinSpace
construct an array of equally spaced values
qwtLogSpace
construct an array of logarithmically equally spaced values
qwtMax
Return the largest of two values
qwtMin
Return the smallest of two values
qwtAbs
return the absolute value
qwtSign
Return the sign of a number
qwtSqr
Return the square of a number
qwtCopyArray
Copy an array into another
qwtShiftArray
Shift an array
qwtSwap
Swap two values
qwtSort (1)
Sort two values
qwtSort (2)
Sort two values
qwtInt
Return nearest integer
qwtLim
Limit a values

qwtGetMin

Find the smallest value in an array

Syntax

double qwtGetMin(double *array, int size)

Parameters

double *array, int size

qwtGetMax

Find the largest value in an array

Syntax

double qwtGetMax(double *array, int size)

Parameters

double *array, int size

qwtCeil125

Find the smallest value out of {1,2,5}*10^n with an integer number n which is greater than or equal to x

Syntax

double qwtCeil125(double x)

Parameters

double x

qwtFloor125

Find the largest value out of {1,2,5}*10^n with an integer number n which is smaller than or equal to x

Syntax

double qwtFloor125(double x)

Parameters

double x

qwtChkMono

Checks if an array is a strictly monotonic sequence

Syntax

int qwtChkMono(double *array, int size)

Parameters

double *array
pointer to a double array
int size
size of the array

Return Value

0
sequence is not strictly monotonic
1
sequence is strictly monotonically increasing
-1
sequence is strictly monotonically decreasing

qwtTwistArray

Invert the order of array elements

Syntax

void qwtTwistArray(double *array, int size)

Parameters

double *array, int size

qwtLinSpace

Create an array of equally spaced values

Syntax

void qwtLinSpace(double *array, int size, double xmin, double xmax)

Parameters

double *array
where to put the values
int size
size of the array
double xmin
value associated with index 0
double xmax
value associated with index (size-1)

qwtLogSpace

Create an array of logarithmically equally spaced values

Syntax

void qwtLogSpace(double *array, int size, double xmin, double xmax)

Parameters

double *array
where to put the values
int size
size of the array
double xmin
value associated with index 0
double xmax
value associated with index (size-1)

qwtMax

Return the largest of two values

Syntax

template<class T> const T& qwtMax(const T& x, const T& y)

Parameters

const T& x, const T& y
values to be compared

qwtMin

Return the smallest of two values

Syntax

template<class T> const T& qwtMin(const T& x, const T& y)

Parameters

const T& x, const T& y
values to be compared

qwtAbs

Return the absolute value

Syntax

template<class T> T qwtAbs(const T& x)

Parameters

const T& x
input value

qwtSign

Return the sign

Syntax

template <class T> int qwtSign(const T& x)

Parameters

const T& x
input value

Return Value

1, -1, or 0

qwtSqr

Return the square of a number

Syntax

template<class T> T qwtSqr(const T& x)

Parameters

const T& x
input value

qwtCopyArray

Copy an array into another

Syntax

template <class T> void qwtCopyArray(T* dest, T* src, int n)

Parameters

T* dest
destination
T* src
source
int n
number of elements

qwtShiftArray

Shift an array by a specified number of positions

Syntax

template<class T> void qwtShiftArray(T* arr, int size, int di)

Parameters

T* arr
Pointer to an array
int size
Number of elements
int di
Number of positions. A positive number shifts right, a negative number shifts left.

qwtSwap

Swap two values

Syntax

template <class T> void qwtSwap(T &x1, T& x2)

Parameters

T &x1, T& x2
values to be swapped

qwtSort (1)

Sort two values in ascending order

Syntax

template<class T> void qwtSort(T& x1, T& x2)

Parameters

T& x1, T& x2
Values to be sorted

qwtSort (2)

Sort two values in ascending order

Syntax

template<class T> void qwtSort(const T& x1, const T& x2, T& xmax, T& xmin)

Parameters

const T& x1, const T& x2
input values
T& xmax
greater value
T& xmin
smaller value

qwtInt

Round a number to the nearest integer

Syntax

int qwtInt(double x)

Parameters

double x
input value

qwtLim

Limit a value to fit into a specified interval

Syntax

template<class T> T qwtLim( T& x, T& x1, T& x2)

Parameters

const T& x
input value
const T& x1, const T& x2
interval boundaries

Qwt Widget Library 27/04/96