Skip to content

Commit

Permalink
Entropy instance for LinearTransform
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Fox Franke committed Jul 3, 2013
1 parent 9eff104 commit 9a7364e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Statistics/Distribution/Transform.hs
Expand Up @@ -72,6 +72,14 @@ instance (D.Variance d) => D.Variance (LinearTransform d) where
variance (LinearTransform _ sc dist) = sc * sc * D.variance dist
stdDev (LinearTransform _ sc dist) = sc * D.stdDev dist

instance (D.MaybeEntropy d, D.DiscreteDistr d)
=> D.MaybeEntropy (LinearTransform d) where
maybeEntropy (LinearTransform _ _ dist) = D.maybeEntropy dist

instance (D.Entropy d, D.DiscreteDistr d)
=> D.Entropy (LinearTransform d) where
entropy (LinearTransform _ _ dist) = D.entropy dist

instance D.ContGen d => D.ContGen (LinearTransform d) where
genContVar (LinearTransform loc sc d) g = do
x <- D.genContVar d g
Expand Down

0 comments on commit 9a7364e

Please sign in to comment.