⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vnl_sample.h

📁 InsightToolkit-1.4.0(有大量的优化算法程序)
💻 H
字号:
// This is vxl/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

//: 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);

//: uniform 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);

// P(X = k) = [kth term in binomial expansion of (p + (1-p))^n]
//int vnl_sample_binomial(int n, int k, double p);

// ----------------------------------------

//: 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);
}

#endif // vnl_sample_h_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -