Skip to content

Instantly share code, notes, and snippets.

@xxx
Created September 18, 2010 02:35
Show Gist options
  • Select an option

  • Save xxx/585271 to your computer and use it in GitHub Desktop.

Select an option

Save xxx/585271 to your computer and use it in GitHub Desktop.
class GThang
def onedkernel(sigma, radius = 3)
(0 - radius).upto(0 + radius).map do |x|
onedgaussian(sigma, x)
end
end
def onedgaussian(sigma, x)
twosigsquared = 2.0 * sigma * sigma
(1.0 / (Math.sqrt(2 * Math::PI) * sigma)) * (Math::E ** (-1 * ((x * x) / two
sigsquared)))
end
end
puts GThang.new.onedkernel(1.4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment