|
TPCCLIB
|
Functions for calculating median. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>#include "tpcextensions.h"#include "tpcstatist.h"Go to the source code of this file.
Functions | |
| double | statMedian (double *a, const int n) |
| double | statKthSmallest (double *a, const int n, const int k) |
Functions for calculating median.
Definition in file median.c.
| double statKthSmallest | ( | double * | a, |
| const int | n, | ||
| const int | k ) |
Returns the kth smallest value in an array of given data.
Algorithm is based on the book Wirth N. Algorithms + data structures = programs. Englewood Cliffs, Prentice-Hall, 1976.
| a | Pointer to data array of size n; data is partially sorted. NaNs are not checked but will lead to a wrong result. |
| n | Length of the data array |
| k | The K value, 0<=K<n. |
Definition at line 55 of file median.c.
Referenced by statMedian().
| double statMedian | ( | double * | a, |
| const int | n ) |
Returns the median in an array of given data. Algorithm is based on the book Wirth N. Algorithms + data structures = programs. Englewood Cliffs, Prentice-Hall, 1976.
| a | Pointer to data array of size n; data is partially sorted. NaNs are not checked but will lead to a wrong result. |
| n | Length of data array. |
Definition at line 25 of file median.c.