/usr/include/ITK-4.9/vnl/vnl_sample.h is in libinsighttoolkit4-dev 4.9.0-4ubuntu1.
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 | // This is core/vnl/vnl_sample.h
#ifndef vnl_sample_h_
#define vnl_sample_h_
#ifdef VCL_NEEDS_PRAGMA_INTERFACE
#pragma interface
#endif
//:
// \file
// \brief easy ways to sample from various probability distributions
// \author fsm
// \verbatim
// Modifications
// 2005-01-01 Peter Vanroose - use simple (but robust) rng when no DRAND48
// 2007-03-26 Peter Vanroose - avoid returning log(0.0) by switching params
// 2010-09-12 Peter Vanroose - added implementation for binomial sampling
// 2010-09-12 Peter Vanroose - added Bernoulli (unfair coin toss) sampling
// \endverbatim
//: re-seed the random number generator.
void vnl_sample_reseed();
//: re-seed the random number generator given a seed.
void vnl_sample_reseed(int seed);
//: return a random number uniformly drawn on [a, b)
double vnl_sample_uniform(double a, double b);
//: two independent samples from a standard normal distribution.
void vnl_sample_normal_2(double *x, double *y);
//: Normal distribution with given mean and standard deviation
double vnl_sample_normal(double mean, double sigma);
//: Return random k, where P(X = k) = [kth term in binomial expansion of (q + (1-q))^n].
// The returned value will lie between 0 and n (but will be -1 when input is nonsense).
int vnl_sample_binomial(int n, double q);
//: Bernoulli distribution ("coin toss").
// The returned value will be 0 (with probability q) or 1 (with probability 1-q).
// For a "fair" coin toss, use q=0.5.
// When q does not lie between 0 and 1, the value -1 is returned.
int vnl_sample_bernoulli(double q);
// ----------------------------------------
//: handy function to fill a range of values.
template <class I>
inline void vnl_sample_uniform(I begin, I end, double a, double b)
{
for (I p=begin; p!=end; ++p)
(*p) = vnl_sample_uniform(a, b);
}
//: handy function to fill a range of values.
template <class I>
inline void vnl_sample_normal(I begin, I end, double mean, double sigma)
{
for (I p=begin; p!=end; ++p)
(*p) = vnl_sample_normal(mean, sigma);
}
//: handy function to fill a range of values.
template <class I>
inline void vnl_sample_binomial(I begin, I end, int n, double q)
{
for (I p=begin; p!=end; ++p)
(*p) = vnl_sample_binomial(n, q);
}
//: handy function to fill a range of values.
template <class I>
inline void vnl_sample_bernoulli(I begin, I end, double q)
{
for (I p=begin; p!=end; ++p)
(*p) = vnl_sample_bernoulli(q);
}
//: handy function to fill a range of values.
template <class I, class T>
inline void vnl_sample_uniform(I begin, I end, double a, double b, T /*dummy*/)
{
for (I p=begin; p!=end; ++p)
(*p) = T(vnl_sample_uniform(a, b));
}
//: handy function to fill a range of values.
template <class I, class T>
inline void vnl_sample_normal(I begin, I end, double mean, double sigma, T /*dummy*/)
{
for (I p=begin; p!=end; ++p)
(*p) = T(vnl_sample_normal(mean, sigma));
}
#endif // vnl_sample_h_
|