summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/Static.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-12-24 10:56:46 +0100
committerAlberto Ruiz <aruiz@um.es>2015-12-24 10:56:46 +0100
commit341c464521bcf79d962aebf4bc9b308ea97eb30b (patch)
tree92398355b123ff7acf1789b6b06efd33892280b9 /packages/base/src/Internal/Static.hs
parent35a7f3355611cd20994f36b43acbd7413e09f558 (diff)
parente97a22d5bbdde5b96d9401a7abb25534a2d45bd1 (diff)
Merge pull request #163 from mstksg/master
Map/Outer Product to Domain class in Static module; NFData instances
Diffstat (limited to 'packages/base/src/Internal/Static.hs')
-rw-r--r--packages/base/src/Internal/Static.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/base/src/Internal/Static.hs b/packages/base/src/Internal/Static.hs
index 0068313..419ff07 100644
--- a/packages/base/src/Internal/Static.hs
+++ b/packages/base/src/Internal/Static.hs
@@ -11,6 +11,7 @@
11{-# LANGUAGE FlexibleInstances #-} 11{-# LANGUAGE FlexibleInstances #-}
12{-# LANGUAGE TypeOperators #-} 12{-# LANGUAGE TypeOperators #-}
13{-# LANGUAGE ViewPatterns #-} 13{-# LANGUAGE ViewPatterns #-}
14{-# LANGUAGE BangPatterns #-}
14 15
15{- | 16{- |
16Module : Internal.Static 17Module : Internal.Static
@@ -28,6 +29,7 @@ import qualified Numeric.LinearAlgebra as LA
28import Numeric.LinearAlgebra hiding (konst,size,R,C) 29import Numeric.LinearAlgebra hiding (konst,size,R,C)
29import Internal.Vector as D hiding (R,C) 30import Internal.Vector as D hiding (R,C)
30import Internal.ST 31import Internal.ST
32import Control.DeepSeq
31import Data.Proxy(Proxy) 33import Data.Proxy(Proxy)
32import Foreign.Storable(Storable) 34import Foreign.Storable(Storable)
33import Text.Printf 35import Text.Printf
@@ -50,6 +52,9 @@ lift2F
50 -> Dim n (c t) -> Dim n (c t) -> Dim n (c t) 52 -> Dim n (c t) -> Dim n (c t) -> Dim n (c t)
51lift2F f (Dim u) (Dim v) = Dim (f u v) 53lift2F f (Dim u) (Dim v) = Dim (f u v)
52 54
55instance NFData t => NFData (Dim n t) where
56 rnf (Dim (force -> !_)) = ()
57
53-------------------------------------------------------------------------------- 58--------------------------------------------------------------------------------
54 59
55newtype R n = R (Dim n (Vector ℝ)) 60newtype R n = R (Dim n (Vector ℝ))
@@ -75,6 +80,18 @@ mkL x = L (Dim (Dim x))
75mkM :: Matrix ℂ -> M m n 80mkM :: Matrix ℂ -> M m n
76mkM x = M (Dim (Dim x)) 81mkM x = M (Dim (Dim x))
77 82
83instance NFData (R n) where
84 rnf (R (force -> !_)) = ()
85
86instance NFData (C n) where
87 rnf (C (force -> !_)) = ()
88
89instance NFData (L n m) where
90 rnf (L (force -> !_)) = ()
91
92instance NFData (M n m) where
93 rnf (M (force -> !_)) = ()
94
78-------------------------------------------------------------------------------- 95--------------------------------------------------------------------------------
79 96
80type V n t = Dim n (Vector t) 97type V n t = Dim n (Vector t)