Class: GSL::GaussianSmoothKernel
Constant Summary collapse
- KERNELS =
{}
Class Method Summary collapse
Methods inherited from Vector
#_dump, _load, #gaussian_smooth, #gaussian_smooth!, #inspect, #join, #mean_no_outliers, #rectangular_smooth, #to_gslv
Class Method Details
.alloc(sigma, delt = 1.0) ⇒ Object
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 |
# File 'lib/gsl_extras.rb', line 1068 def self.alloc(sigma, delt = 1.0) return KERNELS[[sigma,delt]] if KERNELS[[sigma,delt]] npix ||= (3.0*sigma / delt).floor kernel = super(2*npix + 1) for i in 0...kernel.size j = (i - npix) * delt kernel[i] = Math.exp(- j**2 / 2.0 / sigma**2) / ( 2.0 * Math::PI * sigma**2) end KERNELS[[sigma,delt]] = kernel / kernel.sum end |