Commits

Anonymous committed 13d081f

Entropy instance for NormalDistribution

  • Participants
  • Parent commits 62dfaaa

Comments (0)

Files changed (1)

File Statistics/Distribution/Normal.hs

 instance D.Variance NormalDistribution where
     stdDev = stdDev
 
+instance D.Entropy NormalDistribution where
+  entropy d = 0.5 * log (2 * pi * exp 1 * D.variance d)
+
+instance D.MaybeEntropy NormalDistribution where
+  maybeEntropy = Just . D.entropy
+
 instance D.ContGen NormalDistribution where
     genContVar d = MWC.normal (mean d) (stdDev d)
     {-# INLINE genContVar #-}