/usr/include/ranlip/ranlipproc.h is in libranlip-dev 1.0-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | /************ RanLip - universal multivariate random ************************
* variate generatior based on acceptance/rejection
* Procedural interface
*
* begin : May 10 2004
* version : 1.0
* copyright : (C) 2004 by Gleb Beliakov
* email : gleb@deakin.edu.au
*
*
* Copyright (C) 2004 Gleb Beliakov (gleb@deakin.edu.au)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef double (*UFunction)() ;
// computes the probability density function. Should be implemented by the user.
// p is a vector of size dim
typedef double (*DistFun)(double* p, int dim) ;
#ifdef __cplusplus
extern "C" {
#endif
// initialises the tables and arrays for the generator
// should be the first method to call
void InitRanLip(int dim, double* left, double* right);
// sets the pointer to the function which computed the density
void SetDistFunctionRanLip(DistFun dist);
// computes the hat function given the Lipschitz constant
// num refers to the number of cells the domain is subdivided in each direction
// the total number of cells will be num^dim
// numfine is the number of cells in the fine partition. Should be a power of 2
// to speed up calculations
void PrepareHatFunctionRanLip(int num, int numfine, double Lip);
// computes the hat function, and automatically computes the Lipschitz constant
void PrepareHatFunctionAutoRanLip(int num, int numfine, double minLip=0);
// generates a random variate with the required density
void RandomVecRanLip(double* p);
// saves the computed hat function into a file
void SavePartitionRanlip(char * fname);
// loads the hat function from the file
void LoadPartitionRanLip(char * fname);
// to free memory occupied by the generator
void FreeMemRanLip();
// sets the pointer to the uniform random number generator. The default is
// M. Luescher's ranlux generator (see gsl_randist.h)
void SetUniformGeneratorRanLip( UFunction gen );
// sets the seed for the uniform random number generator
void SeedRanLip(int seed);
// gets the seed used for the uniform random number generator
int GetSeedRanLip();
// returns Lipschitz constant computed by PrepareHatFunctionAutoRanLip
double LipschitzRanLip();
// returns the total number of generated random variates (accepted and rejected)
long int Count_totalRanLip();
// returns the number of points at which the hat function is smaller than the density
// if nonzero, the random sequence is incorrect (Lipschitz constant was too low).
long int Count_errorRanLip();
#ifdef __cplusplus
}
#endif
|