#include <math.h>
#include "utilib_dll.h"
#include "_generic.h"
#include <values.h>
#include "DUniform.h"
#include "Uniform.h"
#include "Basic2DArray.h"
#include "IntVector.h"
#include "DoubleVector.h"
#include "BasicArray.h"
#include "default_rng.h"
#include "DoubleMatrix.h"
Go to the source code of this file.
Defines | |
| #define | PI M_PI |
| DEFINE MATHEMATICAL CONSTANTS THESE SHOULD BE UPDATED... A definition for pi. | |
| #define | MAXINT (int)(~((int)0) ^ (1 << (sizeof(int)*8-1))) |
| A macro that defines the maximum integer value. More... | |
| #define | Exp(x) exp(x) |
| A macro masks the 'exp' function, possibly replacing it with 'bufexp' to accelerate the calculation of 'exp'. | |
Functions | |
| template<class T, class V> UTILIB_API T | min (T x, V y) |
| OPERATIONS ON SIMPLE VALUES Return the minimum of two values. | |
| template<class T, class V> UTILIB_API T | max (T x, V y) |
| Return the maximum of two values. | |
| template<class T> UTILIB_API void | swap (T &i, T &j) |
| Swap two values. | |
| UTILIB_API int | calc_filesize (char *filename) |
| MISCELLANEOUS Compute the number of lines in file filename. | |
| UTILIB_API int round | _ ((double x)) |
| Return the integer value of the rounded value of x. More... | |
| UTILIB_API void setup_bufexp | _ ((int tabsz, double xmin, double xmax)) |
Setup the data structures for bufexp. | |
| template<class T> UTILIB_API T | sum (const BasicArray< T > &vec) |
| OPERATIONS ON ARRAYS Sum up the values in an array. | |
| template<class T> UTILIB_API void | shuffle (BasicArray< T > &vec, RNG *rng, size_type num) |
| Shuffle an array. More... | |
| UTILIB_API void | shuffle (BitArray &vec, RNG *rng=&default_rng) |
| Shuffle a bit array using the given random number generator. | |
| template<class T> UTILIB_API void | shuffle (BasicArray< T > &vec, RNG *rng=&default_rng) |
| Shuffle a basic array using the given random number generator. | |
| template<class T> UTILIB_API void | subshuffle (BasicArray< T > &vec, RNG *rng, size_type start, size_type end) |
| Shuffle a subset of an array starting from start and ending at end - 1. More... | |
| template<class T> UTILIB_API double | length (const BasicArray< T > &a) |
| Compute the L_2 norm of the numerical array. | |
| template<class T> UTILIB_API double | dist (const BasicArray< T > &a, const BasicArray< T > &b) |
| Compute the distance between two numerical arrays. | |
| template<class T> UTILIB_API size_type | argmin (const BasicArray< T > &vector) |
| Return the index of the minimal element of the array. | |
| template<class T> UTILIB_API size_type | argmax (const BasicArray< T > &vector) |
| Return the index of the maximal element of the array. | |
| size_type | argmedian (double *x, size_type n, int *ws, RNG *rng) |
| Return the index of the median element of the array. | |
| template<class T> UTILIB_API size_type | argmedian (const BasicArray< T > &vector, RNG *rng=&default_rng) |
| Return the index of the median element of the array. | |
| template<class T> UTILIB_API size_type | argmedian (const BasicArray< T > &vec, BasicArray< int > &ws, RNG *rng=NULL) |
| Return the index of the median element of the array. | |
| template<class T> UTILIB_API T | min (const BasicArray< T > &vec) |
| Return the minimal element of an array. | |
| template<class T> UTILIB_API T | max (const BasicArray< T > &vec) |
| Return the maximal element of an array. | |
| template<class T> UTILIB_API T | median (const BasicArray< T > &vec) |
| Return the median element of an array. | |
| template<class T> UTILIB_API BasicArray< T > | concat (const BasicArray< T > &a, const BasicArray< T > &b) |
| Concatenate two arrays together. | |
| template<class T> double | mean (const BasicArray< T > &array) |
| Compute the mean of an array. | |
| template<class T> double | trimmed_mean (BasicArray< T > &array, const double percent) |
| Compute the trimmed mean of an array. | |
| template<class T> double | var (const BasicArray< T > &array, const int sampleflag=TRUE) |
| Compute the variance of an array. | |
| template<class T> double | mad (BasicArray< T > &array, BasicArray< double > &work) |
| Compute the MAD (mean absolute deviation) of an array, given workspace. | |
| template<class T> double | mad (BasicArray< T > &array) |
| Compute the MAD (mean absolute deviation) of an array. | |
| template<class T> UTILIB_API void | lapply (BasicArray< T > &vec, double(*func)(T val)) |
Apply the function val to the elements of vec. | |
| template<class T> UTILIB_API double | inner_product (const BasicArray< T > &v1, const BasicArray< T > &v2) |
| Compute the inner product between two numerical arrays. | |
| template<class T> NumArray< double > | mean (const Basic2DArray< T > &matrix, const int stats_flag) |
| OPERATIONS ON 2D ARRAYS AND MATRICES Compute the means of the rows of a 2D array. | |
| template<class T> DoubleVector | var (const Basic2DArray< T > &mat, const int sampleflag=TRUE) |
| Compute the variances of the rows of a matrix. | |
| template<class T> DoubleVector | var (const Basic2DArray< T > &mat, BasicArray< double > &array_mean, const int sampleflag=TRUE) |
| Compute the variances of the rows of a 2D array, given the means. | |
| template<class T> UTILIB_API int | min (const Basic2DArray< T > &mat) |
| Return the minimal element of a 2D array. | |
| template<class T> UTILIB_API T | max (const Basic2DArray< T > &mat) |
| Return the maximal element of a 2D array. | |
| template<class T> UTILIB_API T | sum (const Basic2DArray< T > &mat) |
| Return the sum of the elements of a 2D array. | |
| template<class T> void | rowscale (Basic2DArray< T > &a) |
| Scale the rows of a 2D array by a. | |
| UTILIB_API int | cholesky (DoubleMatrix &A, DoubleMatrix &G, int n) |
| Compute the Cholesky decomposition of A. More... | |
|
|
A macro that defines the maximum integer value. Not all systems seem to have a built-in value for this. |
|
|
Return the integer value of the rounded value of x. If the fractional part of x is less than 0.5, then x is rounded down. Otherwise, x is rounded up. |
|
||||||||||||||||
|
Compute the Cholesky decomposition of A. This code assumes that A is symmetric positive definite. It generates a lower triangular G s.t. A = G*G'. This code assumes that the memory in G has been allocated contiguously. |
|
||||||||||||||||||||
|
Shuffle an array. Shuffle performed is Algorithm P (Shuffling) from page 139 of \cite [Knu unknown reference! ]. Only num values are shuffled into the * first num positions on the array. |
|
||||||||||||||||||||||||
|
Shuffle a subset of an array starting from start and ending at end - 1.
Within the range from start to end, the method operates like the |