summaryrefslogtreecommitdiff
path: root/packages/base
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base')
-rw-r--r--packages/base/CHANGELOG7
-rw-r--r--packages/base/THANKS.md8
-rw-r--r--packages/base/hmatrix.cabal2
-rw-r--r--packages/base/src/Internal/Matrix.hs3
-rw-r--r--packages/base/src/Internal/Modular.hs16
-rw-r--r--packages/base/src/Internal/Static.hs18
6 files changed, 33 insertions, 21 deletions
diff --git a/packages/base/CHANGELOG b/packages/base/CHANGELOG
index 581d2ac..3bba3d5 100644
--- a/packages/base/CHANGELOG
+++ b/packages/base/CHANGELOG
@@ -1,3 +1,10 @@
10.18.0.0
2--------
3
4 * meanCov and gaussianSample use Herm type.
5
6 * New functions and instances in the Static module.
7
10.17.0.0 80.17.0.0
2-------- 9--------
3 10
diff --git a/packages/base/THANKS.md b/packages/base/THANKS.md
index 34675d3..c0ef1a3 100644
--- a/packages/base/THANKS.md
+++ b/packages/base/THANKS.md
@@ -205,7 +205,13 @@ module reorganization, monadic mapVectorM, and many other improvements.
205- Vassil Keremidchiev fixed the cabal options for OpenBlas, fixed several installation 205- Vassil Keremidchiev fixed the cabal options for OpenBlas, fixed several installation
206 issues, and added support for stack-based build. 206 issues, and added support for stack-based build.
207 207
208- Greg Nwosu fixed arm compilation
209
208- Patrik Jansson changed meanCov and gaussianSample to use Herm type. Fixed stack.yaml. 210- Patrik Jansson changed meanCov and gaussianSample to use Herm type. Fixed stack.yaml.
209 211
210- Justin Le added NFData instances for Static types and added mapping and outer product methods to Domain. 212- Justin Le added NFData instances for Static types, added mapping and outer product
213 methods to Domain, and many other functions to the Static module.
214
215- Sidharth Kapur added Normed and numeric instances for several Static types, and
216fixed the CPP issue in cabal files.
211 217
diff --git a/packages/base/hmatrix.cabal b/packages/base/hmatrix.cabal
index 5524d2b..aba6fa7 100644
--- a/packages/base/hmatrix.cabal
+++ b/packages/base/hmatrix.cabal
@@ -16,7 +16,7 @@ Description: Linear systems, matrix decompositions, and other numerical c
16 Code examples: <http://dis.um.es/~alberto/hmatrix/hmatrix.html> 16 Code examples: <http://dis.um.es/~alberto/hmatrix/hmatrix.html>
17 17
18Category: Math 18Category: Math
19tested-with: GHC==7.10 19tested-with: GHC==8.0
20 20
21cabal-version: >=1.8 21cabal-version: >=1.8
22 22
diff --git a/packages/base/src/Internal/Matrix.hs b/packages/base/src/Internal/Matrix.hs
index f9b02ca..c47c625 100644
--- a/packages/base/src/Internal/Matrix.hs
+++ b/packages/base/src/Internal/Matrix.hs
@@ -6,8 +6,7 @@
6{-# LANGUAGE TypeFamilies #-} 6{-# LANGUAGE TypeFamilies #-}
7{-# LANGUAGE ViewPatterns #-} 7{-# LANGUAGE ViewPatterns #-}
8{-# LANGUAGE DeriveGeneric #-} 8{-# LANGUAGE DeriveGeneric #-}
9 9{-# LANGUAGE ConstrainedClassMethods #-}
10
11 10
12-- | 11-- |
13-- Module : Internal.Matrix 12-- Module : Internal.Matrix
diff --git a/packages/base/src/Internal/Modular.hs b/packages/base/src/Internal/Modular.hs
index 239c742..f3c59a8 100644
--- a/packages/base/src/Internal/Modular.hs
+++ b/packages/base/src/Internal/Modular.hs
@@ -72,7 +72,7 @@ instance (Ord t, KnownNat m) => Ord (Mod m t)
72 where 72 where
73 compare a b = compare (unMod a) (unMod b) 73 compare a b = compare (unMod a) (unMod b)
74 74
75instance (Real t, KnownNat m, Integral (Mod m t)) => Real (Mod m t) 75instance (Integral t, Real t, KnownNat m, Integral (Mod m t)) => Real (Mod m t)
76 where 76 where
77 toRational x = toInteger x % 1 77 toRational x = toInteger x % 1
78 78
@@ -114,7 +114,7 @@ instance Show t => Show (Mod n t)
114 where 114 where
115 show = show . unMod 115 show = show . unMod
116 116
117instance forall n t . (Integral t, KnownNat n) => Num (Mod n t) 117instance (Integral t, KnownNat n) => Num (Mod n t)
118 where 118 where
119 (+) = l2 (\m a b -> (a + b) `mod` (fromIntegral m)) 119 (+) = l2 (\m a b -> (a + b) `mod` (fromIntegral m))
120 (*) = l2 (\m a b -> (a * b) `mod` (fromIntegral m)) 120 (*) = l2 (\m a b -> (a * b) `mod` (fromIntegral m))
@@ -159,11 +159,11 @@ instance KnownNat m => Element (Mod m Z)
159 m' = fromIntegral . natVal $ (undefined :: Proxy m) 159 m' = fromIntegral . natVal $ (undefined :: Proxy m)
160 160
161 161
162instance forall m . KnownNat m => CTrans (Mod m I) 162instance KnownNat m => CTrans (Mod m I)
163instance forall m . KnownNat m => CTrans (Mod m Z) 163instance KnownNat m => CTrans (Mod m Z)
164 164
165 165
166instance forall m . KnownNat m => Container Vector (Mod m I) 166instance KnownNat m => Container Vector (Mod m I)
167 where 167 where
168 conj' = id 168 conj' = id
169 size' = dim 169 size' = dim
@@ -203,7 +203,7 @@ instance forall m . KnownNat m => Container Vector (Mod m I)
203 fromZ' = vmod . fromZ' 203 fromZ' = vmod . fromZ'
204 toZ' = toZ' . f2i 204 toZ' = toZ' . f2i
205 205
206instance forall m . KnownNat m => Container Vector (Mod m Z) 206instance KnownNat m => Container Vector (Mod m Z)
207 where 207 where
208 conj' = id 208 conj' = id
209 size' = dim 209 size' = dim
@@ -311,7 +311,7 @@ lift2 f a b = vmod (f (f2i a) (f2i b))
311 311
312lift2m f a b = liftMatrix vmod (f (f2iM a) (f2iM b)) 312lift2m f a b = liftMatrix vmod (f (f2iM a) (f2iM b))
313 313
314instance forall m . KnownNat m => Num (Vector (Mod m I)) 314instance KnownNat m => Num (Vector (Mod m I))
315 where 315 where
316 (+) = lift2 (+) 316 (+) = lift2 (+)
317 (*) = lift2 (*) 317 (*) = lift2 (*)
@@ -321,7 +321,7 @@ instance forall m . KnownNat m => Num (Vector (Mod m I))
321 negate = lift1 negate 321 negate = lift1 negate
322 fromInteger x = fromInt (fromInteger x) 322 fromInteger x = fromInt (fromInteger x)
323 323
324instance forall m . KnownNat m => Num (Vector (Mod m Z)) 324instance KnownNat m => Num (Vector (Mod m Z))
325 where 325 where
326 (+) = lift2 (+) 326 (+) = lift2 (+)
327 (*) = lift2 (*) 327 (*) = lift2 (*)
diff --git a/packages/base/src/Internal/Static.hs b/packages/base/src/Internal/Static.hs
index 0ad2cad..1e9a5a3 100644
--- a/packages/base/src/Internal/Static.hs
+++ b/packages/base/src/Internal/Static.hs
@@ -207,7 +207,7 @@ singleV v = LA.size v == 1
207singleM m = rows m == 1 && cols m == 1 207singleM m = rows m == 1 && cols m == 1
208 208
209 209
210instance forall n. KnownNat n => Sized ℂ (C n) Vector 210instance KnownNat n => Sized ℂ (C n) Vector
211 where 211 where
212 size _ = fromIntegral . natVal $ (undefined :: Proxy n) 212 size _ = fromIntegral . natVal $ (undefined :: Proxy n)
213 konst x = mkC (LA.scalar x) 213 konst x = mkC (LA.scalar x)
@@ -223,7 +223,7 @@ instance forall n. KnownNat n => Sized ℂ (C n) Vector
223 r = mkC v :: C n 223 r = mkC v :: C n
224 224
225 225
226instance forall n. KnownNat n => Sized ℝ (R n) Vector 226instance KnownNat n => Sized ℝ (R n) Vector
227 where 227 where
228 size _ = fromIntegral . natVal $ (undefined :: Proxy n) 228 size _ = fromIntegral . natVal $ (undefined :: Proxy n)
229 konst x = mkR (LA.scalar x) 229 konst x = mkR (LA.scalar x)
@@ -240,7 +240,7 @@ instance forall n. KnownNat n => Sized ℝ (R n) Vector
240 240
241 241
242 242
243instance forall m n . (KnownNat m, KnownNat n) => Sized ℝ (L m n) Matrix 243instance (KnownNat m, KnownNat n) => Sized ℝ (L m n) Matrix
244 where 244 where
245 size _ = ((fromIntegral . natVal) (undefined :: Proxy m) 245 size _ = ((fromIntegral . natVal) (undefined :: Proxy m)
246 ,(fromIntegral . natVal) (undefined :: Proxy n)) 246 ,(fromIntegral . natVal) (undefined :: Proxy n))
@@ -258,7 +258,7 @@ instance forall m n . (KnownNat m, KnownNat n) => Sized ℝ (L m n) Matrix
258 r = mkL x :: L m n 258 r = mkL x :: L m n
259 259
260 260
261instance forall m n . (KnownNat m, KnownNat n) => Sized ℂ (M m n) Matrix 261instance (KnownNat m, KnownNat n) => Sized ℂ (M m n) Matrix
262 where 262 where
263 size _ = ((fromIntegral . natVal) (undefined :: Proxy m) 263 size _ = ((fromIntegral . natVal) (undefined :: Proxy m)
264 ,(fromIntegral . natVal) (undefined :: Proxy n)) 264 ,(fromIntegral . natVal) (undefined :: Proxy n))
@@ -316,7 +316,7 @@ isDiagg (Dim (Dim x))
316 316
317-------------------------------------------------------------------------------- 317--------------------------------------------------------------------------------
318 318
319instance forall n . KnownNat n => Show (R n) 319instance KnownNat n => Show (R n)
320 where 320 where
321 show s@(R (Dim v)) 321 show s@(R (Dim v))
322 | singleV v = "("++show (v!0)++" :: R "++show d++")" 322 | singleV v = "("++show (v!0)++" :: R "++show d++")"
@@ -324,7 +324,7 @@ instance forall n . KnownNat n => Show (R n)
324 where 324 where
325 d = size s 325 d = size s
326 326
327instance forall n . KnownNat n => Show (C n) 327instance KnownNat n => Show (C n)
328 where 328 where
329 show s@(C (Dim v)) 329 show s@(C (Dim v))
330 | singleV v = "("++show (v!0)++" :: C "++show d++")" 330 | singleV v = "("++show (v!0)++" :: C "++show d++")"
@@ -332,7 +332,7 @@ instance forall n . KnownNat n => Show (C n)
332 where 332 where
333 d = size s 333 d = size s
334 334
335instance forall m n . (KnownNat m, KnownNat n) => Show (L m n) 335instance (KnownNat m, KnownNat n) => Show (L m n)
336 where 336 where
337 show (isDiag -> Just (z,y,(m',n'))) = printf "(diag %s %s :: L %d %d)" (show z) (drop 9 $ show y) m' n' 337 show (isDiag -> Just (z,y,(m',n'))) = printf "(diag %s %s :: L %d %d)" (show z) (drop 9 $ show y) m' n'
338 show s@(L (Dim (Dim x))) 338 show s@(L (Dim (Dim x)))
@@ -341,7 +341,7 @@ instance forall m n . (KnownNat m, KnownNat n) => Show (L m n)
341 where 341 where
342 (m',n') = size s 342 (m',n') = size s
343 343
344instance forall m n . (KnownNat m, KnownNat n) => Show (M m n) 344instance (KnownNat m, KnownNat n) => Show (M m n)
345 where 345 where
346 show (isDiagC -> Just (z,y,(m',n'))) = printf "(diag %s %s :: M %d %d)" (show z) (drop 9 $ show y) m' n' 346 show (isDiagC -> Just (z,y,(m',n'))) = printf "(diag %s %s :: M %d %d)" (show z) (drop 9 $ show y) m' n'
347 show s@(M (Dim (Dim x))) 347 show s@(M (Dim (Dim x)))
@@ -352,7 +352,7 @@ instance forall m n . (KnownNat m, KnownNat n) => Show (M m n)
352 352
353-------------------------------------------------------------------------------- 353--------------------------------------------------------------------------------
354 354
355instance forall n t . (Num (Vector t), Numeric t )=> Num (Dim n (Vector t)) 355instance (Num (Vector t), Numeric t )=> Num (Dim n (Vector t))
356 where 356 where
357 (+) = lift2F (+) 357 (+) = lift2F (+)
358 (*) = lift2F (*) 358 (*) = lift2F (*)