Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add inline pragma to sqr

  • Loading branch information...
commit e1d5e0a4f6f44d5cb169a8acdebab8d0330333a3 1 parent 2349553
Aleksey Khudyakov Shimuuar authored

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +5 2 System/Random/MWC/Distributions.hs
7 System/Random/MWC/Distributions.hs
@@ -20,9 +20,12 @@ import qualified Data.Vector.Unboxed.Mutable as M
20 20
21 21 import System.Random.MWC
22 22
  23 +
  24 +
23 25 -- Unboxed 2-tuple
24 26 data T = T {-# UNPACK #-} !Double {-# UNPACK #-} !Double
25 27
  28 +
26 29 -- | Generate a normally distributed random variate with given mean
27 30 -- and standard deviation
28 31 normal :: PrimMonad m
@@ -35,6 +38,7 @@ normal m s gen = do
35 38 x <- standard gen
36 39 return $! m + s * x
37 40
  41 +
38 42 -- | Generate a normally distributed random variate with zero mean and
39 43 -- unit variance.
40 44 --
@@ -95,7 +99,6 @@ exponential beta gen = do
95 99 return $! - log x / beta
96 100
97 101
98   -
99 102 -- | Random variate generator for gamma distribution
100 103 gamma :: PrimMonad m
101 104 => Double -- ^ Shape parameter
@@ -129,7 +132,6 @@ gamma a b gen
129 132 a2 = 1 / sqrt(9 * a1)
130 133
131 134
132   -
133 135 -- | Random variate generator for chi square distribution
134 136 chiSquare :: PrimMonad m
135 137 => Int -- ^ Number of degrees of freedom
@@ -144,3 +146,4 @@ chiSquare n gen
144 146
145 147 sqr :: Double -> Double
146 148 sqr x = x * x
  149 +{-# INLINE sqr #-}

0 comments on commit e1d5e0a

Please sign in to comment.
Something went wrong with that request. Please try again.