diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-20 19:32:19 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-20 19:32:19 +0200 |
commit | 9412ef25f2a9d6f6ca233ef123a01c3f4145ffa4 (patch) | |
tree | b5c7ecd0534d0dc34242e53a3e66b87fc2ec0b0f /packages/base/src/Data/Packed | |
parent | d0fc6c7192badfa6f03baf0e02e0cf2a73c3906b (diff) |
random numbers in base
Diffstat (limited to 'packages/base/src/Data/Packed')
-rw-r--r-- | packages/base/src/Data/Packed/IO.hs | 2 | ||||
-rw-r--r-- | packages/base/src/Data/Packed/Numeric.hs | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/packages/base/src/Data/Packed/IO.hs b/packages/base/src/Data/Packed/IO.hs index db03d5f..94fb30a 100644 --- a/packages/base/src/Data/Packed/IO.hs +++ b/packages/base/src/Data/Packed/IO.hs | |||
@@ -149,6 +149,8 @@ apparentCols s = f . dropWhile null . map words . lines <$> readFile s | |||
149 | f [] = 0 | 149 | f [] = 0 |
150 | f (x:_) = length x | 150 | f (x:_) = length x |
151 | 151 | ||
152 | |||
153 | -- | load a matrix from an ASCII file formatted as a 2D table. | ||
152 | loadMatrix :: FilePath -> IO (Matrix Double) | 154 | loadMatrix :: FilePath -> IO (Matrix Double) |
153 | loadMatrix f = do | 155 | loadMatrix f = do |
154 | v <- vectorScan f | 156 | v <- vectorScan f |
diff --git a/packages/base/src/Data/Packed/Numeric.hs b/packages/base/src/Data/Packed/Numeric.hs index 6036e8c..d130ecd 100644 --- a/packages/base/src/Data/Packed/Numeric.hs +++ b/packages/base/src/Data/Packed/Numeric.hs | |||
@@ -84,7 +84,7 @@ linspace n (a,b) = addConstant a $ scale s $ fromList $ map fromIntegral [0 .. n | |||
84 | class Contraction a b c | a b -> c | 84 | class Contraction a b c | a b -> c |
85 | where | 85 | where |
86 | infixl 7 <.> | 86 | infixl 7 <.> |
87 | {- | Matrix product, matrix vector product, and dot product | 87 | {- | Matrix product, matrix - vector product, and dot product |
88 | 88 | ||
89 | Examples: | 89 | Examples: |
90 | 90 | ||
@@ -223,11 +223,7 @@ instance Container Matrix e => Build (Int,Int) (e -> e -> e) Matrix e | |||
223 | 223 | ||
224 | -------------------------------------------------------------------------------- | 224 | -------------------------------------------------------------------------------- |
225 | 225 | ||
226 | {- | alternative operator for '(\<.\>)' | 226 | -- | alternative unicode symbol (25c7) for the contraction operator '(\<.\>)' |
227 | |||
228 | x25c7, white diamond | ||
229 | |||
230 | -} | ||
231 | (◇) :: Contraction a b c => a -> b -> c | 227 | (◇) :: Contraction a b c => a -> b -> c |
232 | infixl 7 ◇ | 228 | infixl 7 ◇ |
233 | (◇) = (<.>) | 229 | (◇) = (<.>) |