Go to the documentation of this file.00001
00002 #ifndef vnl_sample_h_
00003 #define vnl_sample_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 void vnl_sample_reseed();
00021
00022
00023 void vnl_sample_reseed(int seed);
00024
00025
00026 double vnl_sample_uniform(double a, double b);
00027
00028
00029 void vnl_sample_normal_2(double *x, double *y);
00030
00031
00032 double vnl_sample_normal(double mean, double sigma);
00033
00034
00035
00036 int vnl_sample_binomial(int n, double q);
00037
00038
00039
00040
00041
00042 int vnl_sample_bernoulli(double q);
00043
00044
00045
00046
00047 template <class I>
00048 inline void vnl_sample_uniform(I begin, I end, double a, double b)
00049 {
00050 for (I p=begin; p!=end; ++p)
00051 (*p) = vnl_sample_uniform(a, b);
00052 }
00053
00054
00055 template <class I>
00056 inline void vnl_sample_normal(I begin, I end, double mean, double sigma)
00057 {
00058 for (I p=begin; p!=end; ++p)
00059 (*p) = vnl_sample_normal(mean, sigma);
00060 }
00061
00062
00063 template <class I>
00064 inline void vnl_sample_binomial(I begin, I end, int n, double q)
00065 {
00066 for (I p=begin; p!=end; ++p)
00067 (*p) = vnl_sample_binomial(n, q);
00068 }
00069
00070
00071 template <class I>
00072 inline void vnl_sample_bernoulli(I begin, I end, double q)
00073 {
00074 for (I p=begin; p!=end; ++p)
00075 (*p) = vnl_sample_bernoulli(q);
00076 }
00077
00078
00079 template <class I, class T>
00080 inline void vnl_sample_uniform(I begin, I end, double a, double b, T )
00081 {
00082 for (I p=begin; p!=end; ++p)
00083 (*p) = T(vnl_sample_uniform(a, b));
00084 }
00085
00086
00087 template <class I, class T>
00088 inline void vnl_sample_normal(I begin, I end, double mean, double sigma, T )
00089 {
00090 for (I p=begin; p!=end; ++p)
00091 (*p) = T(vnl_sample_normal(mean, sigma));
00092 }
00093
00094 #endif // vnl_sample_h_