Bioplib
Protein Structure C Library
|
Prototypes, etc. for maths utility routines. More...
Go to the source code of this file.
Macros | |
#define | _MATHUTIL_H_DEPRECATED |
Functions | |
void | blCalcSD (REAL val, int action, REAL *mean, REAL *SD) |
void | blCalcExtSD (REAL val, int action, REAL *Sx, REAL *SxSq, int *NValues, REAL *mean, REAL *SD) |
REAL | blPearson (REAL *x, REAL *y, int NItem) |
REAL | blPearson1 (REAL *x, REAL *y, int NItem) |
void | blCrossProd3 (VEC3F *Out, VEC3F In1, VEC3F In2) |
void | blVecSub3 (VEC3F *Out, VEC3F In1, VEC3F In2) |
void | blVecAdd3 (VEC3F *Out, VEC3F In1, VEC3F In2) |
REAL | blVecLen3 (VEC3F Vec) |
REAL | blDistPtLine (VEC3F Point, VEC3F End1, VEC3F End2) |
REAL | blPointLineDistance (REAL Px, REAL Py, REAL Pz, REAL P1x, REAL P1y, REAL P1z, REAL P2x, REAL P2y, REAL P2z, REAL *Rx, REAL *Ry, REAL *Rz, REAL *frac) |
ULONG | blFactorial (int n) |
ULONG | blFactdiv (int n1, int n2) |
ULONG | blNPerm (int n, int r) |
ULONG | blNComb (int n, int r) |
BOOL | blIsPrime (ULONG input) |
ULONG | blFindNextPrime (ULONG input, BOOL above) |
Prototypes, etc. for maths utility routines.
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.
Definition in file MathUtil.h.
#define _MATHUTIL_H_DEPRECATED |
Definition at line 96 of file MathUtil.h.
void blCalcExtSD | ( | REAL | val, |
int | action, | ||
REAL * | Sx, | ||
REAL * | SxSq, | ||
int * | NValues, | ||
REAL * | mean, | ||
REAL * | SD | ||
) |
[in] | val | The value to be sampled |
[in] | action | 0: Sample the value 1: Calculate & return mean and SD 2: Clear the sample lists |
[out] | mean | The returned mean |
[out] | SD | The returned standard deviation |
[in,out] | Sx | Sum of values |
[in,out] | SxSq | Sum of values squared |
[in,out] | NValues | Number 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
Definition at line 137 of file CalcExtSD.c.
[in] | val | The value to be sampled |
[in] | action | 0: Sample the value 1: Calculate & return mean and SD 2: Clear the sample lists |
[out] | mean | The returned mean |
[out] | SD | The returned standard deviation |
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
[in] | In1 | First vector |
[in] | In2 | Second vector |
[out] | Out | Output vector |
Calculate the cross product of 2 3-vectors
Definition at line 94 of file CrossProd3.c.
[in] | Point | The coordinates of a point |
[in] | End1 | Coordinates of one end of vector |
[in] | End2 | Coordinates of other end of vector |
Calculate the distance from a point to a line described by two vector end points
Definition at line 100 of file DistPtLine.c.
ULONG blFactdiv | ( | int | n1, |
int | n2 | ||
) |
ULONG blFactorial | ( | int | n | ) |
Calculates the factorial of an integer. Returns 0 on numeric overflow.
Definition at line 89 of file factorial.c.
ULONG blNComb | ( | int | n, |
int | r | ||
) |
ULONG blNPerm | ( | int | n, |
int | r | ||
) |
[in] | *x | Array of x items |
[in] | *y | Array of y items |
[in] | NItem | Number of items |
Calculates the Pearson correlation coefficient This version makes 2 passes through the data
[in] | *x | Array of x items |
[in] | *y | Array of y items |
[in] | NItem | Number of items |
This version makes a single pass through the data
Definition at line 98 of file pearson1.c.
REAL blPointLineDistance | ( | REAL | Px, |
REAL | Py, | ||
REAL | Pz, | ||
REAL | P1x, | ||
REAL | P1y, | ||
REAL | P1z, | ||
REAL | P2x, | ||
REAL | P2y, | ||
REAL | P2z, | ||
REAL * | Rx, | ||
REAL * | Ry, | ||
REAL * | Rz, | ||
REAL * | frac | ||
) |
[in] | Px | Point x coordinate |
[in] | Py | Point y coordinate |
[in] | Pz | Point z coordinate |
[in] | P1x | Line start x coordinate |
[in] | P1y | Line start y coordinate |
[in] | P1z | Line start z coordinate |
[in] | P2x | Line end x coordinate |
[in] | P2y | Line end y coordinate |
[in] | P2z | Line end z coordinate |
[out] | *Rx | Nearest point on line x coordinate |
[out] | *Ry | Nearest point on line y coordinate |
[out] | *Rz | Nearest point on line z coordinate |
[out] | *frac | Fraction along P1-P2 of R |
Calculates the shortest distance from a point P to a line between points P1 and P2. This value is returned.
If the Rx,Ry,Rz pointers are all non-NULL, then the point on the line nearest to P is output.
If the frac pointer is non-NULL then the fraction of R along the P1-P2 vector is output. Thus: R==P1 ==> frac=0 R==P2 ==> frac=1 Thus if (0<=frac<=1) then the point R is within the line segment P1-P2