Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
CalcExtSD.c File Reference

Calculate mean and standard deviation. More...

#include <math.h>
#include "MathType.h"

Go to the source code of this file.

Functions

void blCalcExtSD (REAL val, int action, REAL *Sx, REAL *SxSq, int *NValues, REAL *mean, REAL *SD)
 

Detailed Description

Calculate mean and standard deviation.

Version
V1.4
Date
07.07.14
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

This routine calculates the mean and standard deviation from a set of numbers. The routine is called with each value to be sampled and the action required is specified.

Usage:

  #include "MathUtil.h" before using these routines

  void CalcExtSD(REAL val, int action, REAL *Sx, REAL *SxSq, 
                 int *NValues, REAL *mean, REAL *SD)
  ----------------------------------------------------------
  Input:   val     int       The value to be sampled
  Input:   action  short     0: Sample the value
                             1: Calculate & return mean and SD
                             2: Clear the sample lists
  Output:  mean    *REAL     The returned mean
  Output:  SD      *REAL     The returned standard deviation
  I/O:     Sx      *REAL     Sum of values
  I/O:     SxSq    *REAL     Sum of values squared
  I/O:     NValues *int      Number of values

  The output values are only set when action==1

Revision History:

Definition in file CalcExtSD.c.

Function Documentation

void blCalcExtSD ( REAL  val,
int  action,
REAL Sx,
REAL SxSq,
int *  NValues,
REAL mean,
REAL SD 
)
Parameters
[in]valThe value to be sampled
[in]action0: Sample the value 1: Calculate & return mean and SD 2: Clear the sample lists
[out]meanThe returned mean
[out]SDThe returned standard deviation
[in,out]SxSum of values
[in,out]SxSqSum of values squared
[in,out]NValuesNumber of values

Calculate the mean and standard deviation from a set of numbers. The routine is called with each value to be sampled and the action required is specified:

The output values are only set when action==1

This is the same as blCalcSD() except that the Sx, SxSq and NValues variables are kept outside the function instead of being static within the function

  • 13.10.93 Original based on CalcSD By: ACRM
  • 22.06.94 Fixed for only one value supplied
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 137 of file CalcExtSD.c.