summaryrefslogtreecommitdiff
path: root/examples/inplace.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-06-06 15:41:48 +0000
committerAlberto Ruiz <aruiz@um.es>2008-06-06 15:41:48 +0000
commita407c0e101f8f6db44fcf731ebb8460d0f691196 (patch)
tree8bfefb55548279305d2005ef8e5fbfba23b426cd /examples/inplace.hs
parentfa7d2f17cbba1de2e900432e07bf4e1e7da2caab (diff)
range checking and other additions to the mutable interface
Diffstat (limited to 'examples/inplace.hs')
-rw-r--r--examples/inplace.hs6
1 files changed, 1 insertions, 5 deletions
diff --git a/examples/inplace.hs b/examples/inplace.hs
index d32933a..29fac6f 100644
--- a/examples/inplace.hs
+++ b/examples/inplace.hs
@@ -23,9 +23,6 @@ main = sequence_[
23-- helper functions 23-- helper functions
24vector l = fromList l :: Vector Double 24vector l = fromList l :: Vector Double
25norm v = pnorm PNorm2 v 25norm v = pnorm PNorm2 v
26zeros n m = reshape m (constant 0 (n*m))
27newMatrix n m = thawMatrix (zeros n m)
28
29 26
30-- hmatrix vector and matrix 27-- hmatrix vector and matrix
31v = vector [1..10] 28v = vector [1..10]
@@ -47,7 +44,7 @@ test2 = antiDiag 5 8 [1..] :: Matrix Double
47 44
48antiDiag :: (Element b) => Int -> Int -> [b] -> Matrix b 45antiDiag :: (Element b) => Int -> Int -> [b] -> Matrix b
49antiDiag r c l = runSTMatrix $ do 46antiDiag r c l = runSTMatrix $ do
50 m <- newMatrix r c 47 m <- newMatrix 0 r c
51 let d = min r c - 1 48 let d = min r c - 1
52 sequence_ $ zipWith (\i v -> writeMatrix m i (c-1-i) v) [0..d] l 49 sequence_ $ zipWith (\i v -> writeMatrix m i (c-1-i) v) [0..d] l
53 return m 50 return m
@@ -115,4 +112,3 @@ test0 = do
115 print m 112 print m
116 --print hv 113 --print hv
117 --print hm 114 --print hm
118