
A collecion of methematical routines. All functions are static. More...
#include "us_math2.h"
Classes | |
| class | Peptide |
| A structure used for calculating a peptide sequence. More... | |
| class | SolutionData |
| A structure used for holding solution data. More... | |
Static Public Member Functions | |
| static double | box_muller (double, double) |
| Normal random variate generator. More... | |
| static double | ranf (void) |
| Return a random floating point number. More... | |
| static double | linefit (double **, double **, double *, double *, double *, double *, int) |
| Given a line as a set of x and y coordinates, calculate the line's characteristics. More... | |
| static int | nearest_curve_point (double *, double *, const int, bool, double &, double &, double *, double *, double *, double *) |
| Given a set of curve points and a given outside point, return the curve point nearest the given point. Return either a point in the curve array or one interpolated based on distance. Optionally also return a value in a third dimension that corresponds to the nearest point. More... | |
| static bool | intersect (double &, double &, double &, double &, double *, double *) |
| Given the slopes and intercepts of two lines, return the intersection point of the two lines, if it exists. More... | |
| static bool | intersect (double *, double *, int, double *, double *, int, double *, double *) |
| Given arrays representing two curves, return the intersection point of two lines fitted to them, if it exists. More... | |
| static void | calc_vbar (Peptide &, const QString &, double) |
| A routine to calculate the vbar and MW of a peptide sequence. More... | |
| static double | adjust_vbar20 (double vbar, double degC) |
| static double | adjust_vbar (double vbar, double degC) |
| The inverse of adjust_vbar20. Returns vbar20. More... | |
| static void | data_correction (double, SolutionData &) |
| Correct buffer data for temperature. More... | |
| static double | normal_distribution (double, double, double) |
| A routine to calculate the value of a normally distributed value. More... | |
| static double | time_correction (const QVector< US_DataIO::EditedData > &) |
| Calculate the time correction in a run due to acceleration of the rotor. More... | |
| static uint | randomize (void) |
| Set the sysem random sequence. More... | |
| static uint | randomize (uint) |
| Set the sysem random sequence. More... | |
| static int | nnls (double *a, int a_dim1, int m, int n, double *b, double *x, double *rnorm=NULL, double *wp=NULL, double *zzp=NULL, int *indexp=NULL) |
| static void | gaussian_smoothing (QVector< double > &, int) |
| Remove high frequency noise from a signal. More... | |
| static double | calcCommonVbar (US_Solution &, double) |
| Calculate common vbar of a solution. More... | |
| static double | erfc (double) |
| An approximation of the Complimentary Gauss Error Fiunction, erfc(). Use for WIN32 only as Linux already has it implemented in <math.h> More... | |
| static int | best_grid_reps (int &, int &) |
| Compute best uniform grid repetitions for 2DSA and possibly modify grid point counts in each dimension. More... | |
Static Private Member Functions | |
| static void | _nnls_g1 (double a, double b, double *, double *, double *) |
| static int | _nnls_h12 (int, int, int, int m, double *, int, double *, double *, int, int, int) |
A collecion of methematical routines. All functions are static.
Definition at line 25 of file us_math2.h.
|
staticprivate |
Definition at line 1058 of file us_math2.cpp.
|
staticprivate |
Definition at line 1102 of file us_math2.cpp.
|
inlinestatic |
The inverse of adjust_vbar20. Returns vbar20.
| vbar | The vbar value at the specified temperature |
| degC | The temperature of the sample associated with vbar |
Definition at line 177 of file us_math2.h.
|
inlinestatic |
Adjust the vbar for temperature. The values used in the unadjusted calculations are based on 20 degrees C. We use an observed linear adjustment of 0.000425 per degreee.
| vbar | The unadjusted vbar value |
| degC | The temperature used for the adjustment |
Definition at line 170 of file us_math2.h.
|
static |
Compute best uniform grid repetitions for 2DSA and possibly modify grid point counts in each dimension.
| ngrid_s | Reference to grid points in the s dimension, both input and possibly modified value |
| ngrid_k | Reference to grid points in the k dimension, both input and possibly modified value |
Definition at line 1364 of file us_math2.cpp.
|
static |
Normal random variate generator.
| m | - mean |
| s | - standard deviation |
Definition at line 22 of file us_math2.cpp.
|
static |
A routine to calculate the vbar and MW of a peptide sequence.
| pep | The structure to be populated |
| sequence | The secuence used for the calculations |
| temperature | The temperature to use for calculations |
Definition at line 311 of file us_math2.cpp.
|
static |
Calculate common vbar of a solution.
| solution | Solution for which to calculate common vbar |
| temperature | Average temperature of associated experiment |
Definition at line 1336 of file us_math2.cpp.
|
static |
Correct buffer data for temperature.
| t | Temperature of solution |
| d | Data to be corrected |
The density of water. An empirical equation derived from density vs temperature data. See Krell, J. Chem. & Eng. Data 1975, 20.
where:
Viscosity of water.
Implements an empirical equation taken from CRC Handbook of Chemistry and Physics, 55th Edition.
For temperature 0 to 20 degress C:
where:
= viscosity in centipoise ( gm / sec-cm / 100 )
= temperature ( Celcius )





For temperature 20 to 100 degrees C:
where:
= viscosity in centipoise ( gm / sec-cm / 100 )
= temperature ( Celcius )



Definition at line 487 of file us_math2.cpp.
|
static |
An approximation of the Complimentary Gauss Error Fiunction, erfc(). Use for WIN32 only as Linux already has it implemented in <math.h>
| x | The input value |
Definition at line 688 of file us_math2.cpp.
|
static |
Remove high frequency noise from a signal.
| array | Data to be smoothed. This array will be modified. |
| smooth | Number of values to smooth to be considered when smoothing |
Definition at line 1215 of file us_math2.cpp.
|
static |
Given the slopes and intercepts of two lines, return the intersection point of the two lines, if it exists.
| slope1 | The slope of the first line |
| intcp1 | The intercept of the first line |
| slope2 | The slope of the second line |
| intcp2 | The intercept of the second line |
| xisec | Pointer for return of x of the intersection point |
| yisec | Pointer for return of y of the intersection point |
Definition at line 272 of file us_math2.cpp.
|
static |
Given arrays representing two curves, return the intersection point of two lines fitted to them, if it exists.
| x1s | An array of x values of the first curve |
| y1s | An array of y values of the first curve |
| npoint1 | The number of points for the first curve |
| x2s | An array of x values of the second curve |
| y2s | An array of y values of the second curve |
| npoint2 | The number of points for the second curve |
| xisec | Pointer for return of x of the intersection point |
| yisec | Pointer for return of y of the intersection point |
Definition at line 289 of file us_math2.cpp.
|
static |
Given a line as a set of x and y coordinates, calculate the line's characteristics.
| x | Pointer to an array of x values |
| y | Pointer to an array of y values |
| slope | Pointer to location to return the line's slope |
| intercept | Pointer to location to return the line's y intercept |
| sigma | Pointer to location to return the standard deviation |
| correlation | Pointer to location to return the correlation |
| arraysize | Input array size |
Definition at line 63 of file us_math2.cpp.
|
static |
Given a set of curve points and a given outside point, return the curve point nearest the given point. Return either a point in the curve array or one interpolated based on distance. Optionally also return a value in a third dimension that corresponds to the nearest point.
| xs | An array of x values of the curve |
| ys | An array of y values of the curve |
| npoints | The number of curve points |
| interp | Flag to interpolate curve point (false->exact point) |
| xgiven | The x value of the given point |
| ygiven | The y value of the given point |
| xnear | Pointer for return of x of the nearest curve point |
| ynear | Pointer for return of y of the nearest curve point |
| zs | Optional third dimension values array (if non-NULL) |
| znear | Optional pointer for return of z for nearest point |
Definition at line 151 of file us_math2.cpp.
|
static |
Algorithm NNLS (Non-negative least-squares)
Given an m by n matrix A, and an m-vector B, computes an n-vector X, that solves the least squares problem A * X = B , subject to X>=0 The A matrix is formatted such that the columns are placed into a vector end-to-end, and the parameter a_dim1 contains the length of each column
Function returns 0 if succesful, 1, if iteration count exceeded 3*N, or 2 in case of invalid problem dimensions or memory allocation error.
Instead of pointers for working space, NULL can be given to let this function to allocate and free the required memory.
| a | The m by n matrix A. On exit, a[] contains the product matrix Q*A, where Q is an m by n orthogonal matrix generated implicitly by this function. The matrix is column major. |
| a_dim1 | Since matrix A is processed as a set of vectors, a_dim1 is needed to specify the storage increment between vectors in a[] |
| m | Columns |
| n | Rows |
| b | On entry, b[] must contain the m-vector B. On exit, b[] contains Q*B |
| x | On exit, x[] will contain the solution vector. |
| rnorm | On exit, rnorm contains the Euclidean norm of the residual vector. It may be set to NULL if the returned value is not needed. |
| wp | An n-array of working space, w[]. On exit, w[] will contain the dual solution vector. w[i]=0.0 for all i in set p and w[ i ] <= 0.0 for all i in set z. |
| zzp | An m-array of working space, zz[]. |
| indexp | An n-array of working space, index[]. |
Definition at line 720 of file us_math2.cpp.
|
static |
A routine to calculate the value of a normally distributed value.
| sigma | Standard deviation of the distribution |
| mean | Mean value of the distribution |
| x | Point where to compute desired value |
Definition at line 621 of file us_math2.cpp.
|
static |
Set the sysem random sequence.
Definition at line 661 of file us_math2.cpp.
Set the sysem random sequence.
| seed | A predetermined seed |
Definition at line 678 of file us_math2.cpp.
|
static |
Return a random floating point number.
Definition at line 57 of file us_math2.cpp.
|
static |
Calculate the time correction in a run due to acceleration of the rotor.
| dataList | The list of editedData for the run |
Definition at line 627 of file us_math2.cpp.
1.8.3.1-20130324