-
Notifications
You must be signed in to change notification settings - Fork 74
Update cabal + add wrapper over MWC #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
a2d8395
f9a37f1
07a96b8
6062033
4855194
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -31,18 +31,24 @@ | |||
| import Data.Binary (Binary(..)) | ||||
| import Data.Data (Data, Typeable) | ||||
| import GHC.Generics (Generic) | ||||
|
|
||||
| import qualified System.Random.MWC.Distributions as MWC | ||||
|
|
||||
| import Numeric.SpecFunctions (incompleteGamma,logFactorial) | ||||
| import Numeric.MathFunctions.Constants (m_neg_inf) | ||||
|
|
||||
|
|
||||
| import qualified Statistics.Distribution as D | ||||
| import qualified Statistics.Distribution.Poisson.Internal as I | ||||
| import Statistics.Internal | ||||
| import Control.Monad (liftM) | ||||
|
Check warning on line 44 in Statistics/Distribution/Poisson.hs
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
| newtype PoissonDistribution = PD { | ||||
| poissonLambda :: Double | ||||
| } deriving (Eq, Typeable, Data, Generic) | ||||
|
Check warning on line 51 in Statistics/Distribution/Poisson.hs
|
||||
|
|
||||
| instance Show PoissonDistribution where | ||||
| showsPrec i (PD l) = defaultShow1 "poisson" l i | ||||
|
|
@@ -93,6 +99,12 @@ | |||
| instance D.MaybeEntropy PoissonDistribution where | ||||
| maybeEntropy = Just . D.entropy | ||||
|
|
||||
| instance D.DiscreteGen PoissonDistribution where | ||||
| genDiscreteVar (PD lambda) = MWC.poisson lambda | ||||
|
|
||||
| instance D.ContGen PoissonDistribution where | ||||
| genContVar (PD lambda) gen = fromIntegral <$> MWC.poisson lambda gen | ||||
|
|
||||
|
Comment on lines
+104
to
+106
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please drop ContGen instance. It is discrete distribution after all
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi @Shimuuar , i am not able to drop statistics/Statistics/Distribution.hs Line 168 in b628309
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed! Sorry I forgot about it |
||||
| -- | Create Poisson distribution. | ||||
| poisson :: Double -> PoissonDistribution | ||||
| poisson l = maybe (error $ errMsg l) id $ poissonE l | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this import needed?