summaryrefslogtreecommitdiff
path: root/packages/hmatrix/src/Numeric/LinearAlgebra
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-05-16 09:28:57 +0200
committerAlberto Ruiz <aruiz@um.es>2014-05-16 09:28:57 +0200
commit5d15d765c0204854b587b03232b20336ddf91ced (patch)
tree18d481c0452f7e26fb4683000f6bc7fa55434efe /packages/hmatrix/src/Numeric/LinearAlgebra
parent0ab93b8eb934167e16dbae193c4fd2b5359a184b (diff)
move rand, randn
Diffstat (limited to 'packages/hmatrix/src/Numeric/LinearAlgebra')
-rw-r--r--packages/hmatrix/src/Numeric/LinearAlgebra/Util.hs27
1 files changed, 0 insertions, 27 deletions
diff --git a/packages/hmatrix/src/Numeric/LinearAlgebra/Util.hs b/packages/hmatrix/src/Numeric/LinearAlgebra/Util.hs
index 7d134bf..fb2d54c 100644
--- a/packages/hmatrix/src/Numeric/LinearAlgebra/Util.hs
+++ b/packages/hmatrix/src/Numeric/LinearAlgebra/Util.hs
@@ -22,7 +22,6 @@ module Numeric.LinearAlgebra.Util(
22 col, 22 col,
23 (&), (¦), (——), (#), 23 (&), (¦), (——), (#),
24 (?), (¿), 24 (?), (¿),
25 rand, randn,
26 cross, 25 cross,
27 norm, 26 norm,
28 unitary, 27 unitary,
@@ -60,7 +59,6 @@ import Numeric.LinearAlgebra.Algorithms hiding (i)
60import Numeric.Matrix() 59import Numeric.Matrix()
61import Numeric.Vector() 60import Numeric.Vector()
62 61
63import System.Random(randomIO)
64import Numeric.LinearAlgebra.Util.Convolution 62import Numeric.LinearAlgebra.Util.Convolution
65import Graphics.Plot 63import Graphics.Plot
66 64
@@ -77,31 +75,6 @@ disp :: Int -> Matrix Double -> IO ()
77 75
78disp n = putStrLn . dispf n 76disp n = putStrLn . dispf n
79 77
80-- | pseudorandom matrix with uniform elements between 0 and 1
81randm :: RandDist
82 -> Int -- ^ rows
83 -> Int -- ^ columns
84 -> IO (Matrix Double)
85randm d r c = do
86 seed <- randomIO
87 return (reshape c $ randomVector seed d (r*c))
88
89-- | pseudorandom matrix with uniform elements between 0 and 1
90rand :: Int -> Int -> IO (Matrix Double)
91rand = randm Uniform
92
93{- | pseudorandom matrix with normal elements
94
95>>> x <- randn 3 5
96>>> disp 3 x
973x5
980.386 -1.141 0.491 -0.510 1.512
990.069 -0.919 1.022 -0.181 0.745
1000.313 -0.670 -0.097 -1.575 -0.583
101
102-}
103randn :: Int -> Int -> IO (Matrix Double)
104randn = randm Gaussian
105 78
106{- | create a real diagonal matrix from a list 79{- | create a real diagonal matrix from a list
107 80