diff options
author | Alberto Ruiz <aruiz@um.es> | 2008-06-06 15:41:48 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2008-06-06 15:41:48 +0000 |
commit | a407c0e101f8f6db44fcf731ebb8460d0f691196 (patch) | |
tree | 8bfefb55548279305d2005ef8e5fbfba23b426cd /examples | |
parent | fa7d2f17cbba1de2e900432e07bf4e1e7da2caab (diff) |
range checking and other additions to the mutable interface
Diffstat (limited to 'examples')
-rw-r--r-- | examples/inplace.hs | 6 |
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 |
24 | vector l = fromList l :: Vector Double | 24 | vector l = fromList l :: Vector Double |
25 | norm v = pnorm PNorm2 v | 25 | norm v = pnorm PNorm2 v |
26 | zeros n m = reshape m (constant 0 (n*m)) | ||
27 | newMatrix n m = thawMatrix (zeros n m) | ||
28 | |||
29 | 26 | ||
30 | -- hmatrix vector and matrix | 27 | -- hmatrix vector and matrix |
31 | v = vector [1..10] | 28 | v = vector [1..10] |
@@ -47,7 +44,7 @@ test2 = antiDiag 5 8 [1..] :: Matrix Double | |||
47 | 44 | ||
48 | antiDiag :: (Element b) => Int -> Int -> [b] -> Matrix b | 45 | antiDiag :: (Element b) => Int -> Int -> [b] -> Matrix b |
49 | antiDiag r c l = runSTMatrix $ do | 46 | antiDiag 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 | |||