on master help sign in
Small fix
commita69c6885086788f7dd98c8af2958ee8c5a725813 authorArmando Santos <armandoifsantos@gmail.com> dateMon 10 Feb 2020, 12:06 (7 years ago) parent11066a8
2 files changed+10−3
app/Benchmarks.hs+7 src/LAoP/Matrix/Internal.hs+3−3
app/Benchmarks.hs+7
@@ -36,6 +36,9 @@ selectD2 ::
3636 ) => Dist (Either a b) -> Matrix Prob a b -> Dist b
3737selectD2 (D d) m = D (junc m identity `comp` d)
3838
39+-- Composition with identity
40+compId m = comp identity m
41+
3942randomDist :: forall a . (Countable a, FromListsN () a) => Gen (Dist a)
4043randomDist = do
4144 let size = fromInteger (natVal (Proxy :: Proxy (Count a)))
@@ -157,6 +160,10 @@ benchmark = defaultMain [
157160 bgroup "200x200" [
158161 bench "WHNF - 200x200" $ whnf (comp m31) m32
159162 , bench "NF - 200x200" $ nf (comp m31) m32
163+ ],
164+ bgroup "200x200 - RULES" [
165+ bench "No rules - 200x200" $ nf (comp m21) identity
166+ , bench "Rules - 200x200" $ nf compId m21
160167 ] ],
161168 env setupEnv2 $ \ ~(m21, m40, dist, dist2, dl1, dl2) -> bgroup "Matrix vs List - `select`" [
162169 bgroup "Distribution `select` - 100+100 / 100x100" [
src/LAoP/Matrix/Internal.hs+3−3
@@ -201,14 +201,14 @@ type family FromNat (n :: Nat) :: Type where
201201 FromNat n = FromNat' (Mod n 2 == 0) (FromNat (Div n 2))
202202
203203type family FromNat' (b :: Bool) (m :: Type) :: Type where
204− FromNat' 'True m = Either m m
204+ FromNat' 'True m = Either m m
205205 FromNat' 'False m = Either () (Either m m)
206206
207207-- | Type family that normalizes the representation of a given data
208208-- structure
209209type family Normalize (d :: Type) :: Type where
210− Normalize (Either a b) = Either (Normalize a) (Normalize b)
211− Normalize d = FromNat (Count d)
210+ Normalize (Either a b) = Either (Normalize a) (Normalize b)
211+ Normalize d = FromNat (Count d)
212212
213213-- | Constraint type synonyms to keep the type signatures less convoluted
214214type Countable a = KnownNat (Count a)