stat.c File Reference


Detailed Description

Implements some simple statistics gathering utilities.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oski/common.h>
#include "abort_prog.h"
#include "testvec.h"
#include "stat.h"

Functions

static int VTMANGLE() compare (const void *a, const void *b)
 "C++ template-like" comparison function
void VTMANGLE() CalcBasicStats (const VALTYPE *x, size_t n, VALTYPE *p_min, VALTYPE *p_max, VALTYPE *p_mean, VALTYPE *p_median)
 Returns the min, mean, median, and max values of the given array.
void VTMANGLE() CalcMinMaxMedian (const VALTYPE *x, size_t n, VALTYPE *p_min, VALTYPE *p_max, VALTYPE *p_median)
 Returns the min, mean, and median values of the given array.
void VTMANGLE() CalcMinMaxMean (const VALTYPE *x, size_t n, VALTYPE *p_min, VALTYPE *p_max, VALTYPE *p_mean)
 Returns the min, mean, and max values of the given array.
VALTYPE VTMANGLE() CalcMin (const VALTYPE *x, size_t n)
 Returns the minimum value of the given array.
VALTYPE VTMANGLE() CalcMax (const VALTYPE *x, size_t n)
 Returns the minimum value of the given array.
VALTYPE VTMANGLE() CalcMean (const VALTYPE *x, size_t n)
 Returns the maximum value of the given array.


Function Documentation

VALTYPE VTMANGLE() CalcMax const VALTYPE *  x,
size_t  n
 

Returns the minimum value of the given array.

Parameters:
[in] x Array over which to compute the statistics. Must not equal NULL if the length, 'n', is greater than 0.
[in] n Length of the array 'x'.
If x is NULL or n <= 0, then this routine generates an error and exits the application.

VALTYPE VTMANGLE() CalcMean const VALTYPE *  x,
size_t  n
 

Returns the maximum value of the given array.

Parameters:
[in] x Array over which to compute the statistics. Must not equal NULL if the length, 'n', is greater than 0.
[in] n Length of the array 'x'.
If x is NULL or n <= 0, then this routine generates an error and exits the application.

VALTYPE VTMANGLE() CalcMin const VALTYPE *  x,
size_t  n
 

Returns the minimum value of the given array.

Parameters:
[in] x Array over which to compute the statistics. Must not equal NULL if the length, 'n', is greater than 0.
[in] n Length of the array 'x'.
If x is NULL or n <= 0, then this routine generates an error and exits the application.

void VTMANGLE() CalcMinMaxMean const VALTYPE *  x,
size_t  n,
VALTYPE *  p_min,
VALTYPE *  p_max,
VALTYPE *  p_mean
 

Returns the min, mean, and max values of the given array.

Parameters:
[in] x Array over which to compute the statistics. Must not equal NULL if the length, 'n', is greater than 0.
[in] n Length of the array 'x'.
[in,out] p_min Pointer to location in which to store the minimum value. If NULL, the minimum is not returned.
[in,out] p_max Pointer to location in which to store the maximum value. If NULL, the maximum is not returned.
[in,out] p_mean Pointer to location in which to store the mean value. If NULL, the mean is not returned.
If n <= 0, this routine simple returns and leaves the variables *p_min, *p_max, *p_mean unchanged. Otherwise, if x is NULL, then this routine exits the application.

void VTMANGLE() CalcMinMaxMedian const VALTYPE *  x,
size_t  n,
VALTYPE *  p_min,
VALTYPE *  p_max,
VALTYPE *  p_median
 

Returns the min, mean, and median values of the given array.

Parameters:
[in] x Array on which to compute statistics. Must not equal NULL if the length, 'n', is greater than 0.
[in] n Length of x.
[in,out] p_min Pointer to location in which to store the minimum value of the array x. If NULL, then the minimum is not returned.
[in,out] p_max Pointer to location in which to store the maximum value of the array x. If NULL, then the maximum is not returned.
[in,out] p_medain Pointer to location in which to store the median value of the array x. Must not equal NULL.
This routine takes no action of n <= 0. If n > 0 and x is not equal to NULL, then this routine aborts.


Generated on Wed Sep 19 16:41:23 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6