diff options
author | Alberto Ruiz <aruiz@um.es> | 2015-06-13 19:18:16 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2015-06-13 19:18:16 +0200 |
commit | 717c680a4b65a2226b0dd6fc13f7c63e7bc0431d (patch) | |
tree | 1775c3c363a0b61f5f6a6ec1f22fe9b7d5864dc4 /packages/base/src/Internal/ST.hs | |
parent | 4b3e29097aa272d429f8005fe17b459cf0c049c8 (diff) |
setRect, general luPacked' based on luST
Diffstat (limited to 'packages/base/src/Internal/ST.hs')
-rw-r--r-- | packages/base/src/Internal/ST.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/base/src/Internal/ST.hs b/packages/base/src/Internal/ST.hs index 107d3c3..a84ca25 100644 --- a/packages/base/src/Internal/ST.hs +++ b/packages/base/src/Internal/ST.hs | |||
@@ -21,7 +21,7 @@ module Internal.ST ( | |||
21 | -- * Mutable Matrices | 21 | -- * Mutable Matrices |
22 | STMatrix, newMatrix, thawMatrix, freezeMatrix, runSTMatrix, | 22 | STMatrix, newMatrix, thawMatrix, freezeMatrix, runSTMatrix, |
23 | readMatrix, writeMatrix, modifyMatrix, liftSTMatrix, | 23 | readMatrix, writeMatrix, modifyMatrix, liftSTMatrix, |
24 | axpy, scal, swap, extractRect, | 24 | axpy, scal, swap, extractMatrix, setMatrix, rowOpST, |
25 | mutable, | 25 | mutable, |
26 | -- * Unsafe functions | 26 | -- * Unsafe functions |
27 | newUndefinedVector, | 27 | newUndefinedVector, |
@@ -166,6 +166,9 @@ readMatrix = safeIndexM unsafeReadMatrix | |||
166 | writeMatrix :: Storable t => STMatrix s t -> Int -> Int -> t -> ST s () | 166 | writeMatrix :: Storable t => STMatrix s t -> Int -> Int -> t -> ST s () |
167 | writeMatrix = safeIndexM unsafeWriteMatrix | 167 | writeMatrix = safeIndexM unsafeWriteMatrix |
168 | 168 | ||
169 | setMatrix :: Element t => STMatrix s t -> Int -> Int -> Matrix t -> ST s () | ||
170 | setMatrix (STMatrix x) i j m = unsafeIOToST $ setRect i j m x | ||
171 | |||
169 | newUndefinedMatrix :: Storable t => MatrixOrder -> Int -> Int -> ST s (STMatrix s t) | 172 | newUndefinedMatrix :: Storable t => MatrixOrder -> Int -> Int -> ST s (STMatrix s t) |
170 | newUndefinedMatrix ord r c = unsafeIOToST $ fmap STMatrix $ createMatrix ord r c | 173 | newUndefinedMatrix ord r c = unsafeIOToST $ fmap STMatrix $ createMatrix ord r c |
171 | 174 | ||
@@ -182,7 +185,7 @@ axpy (STMatrix m) a i j = rowOpST 0 a i j 0 (cols m -1) (STMatrix m) | |||
182 | scal (STMatrix m) a i = rowOpST 1 a i i 0 (cols m -1) (STMatrix m) | 185 | scal (STMatrix m) a i = rowOpST 1 a i i 0 (cols m -1) (STMatrix m) |
183 | swap (STMatrix m) i j = rowOpST 2 0 i j 0 (cols m -1) (STMatrix m) | 186 | swap (STMatrix m) i j = rowOpST 2 0 i j 0 (cols m -1) (STMatrix m) |
184 | 187 | ||
185 | extractRect (STMatrix m) i1 i2 j1 j2 = unsafeIOToST (extractR m 0 (idxs[i1,i2]) 0 (idxs[j1,j2])) | 188 | extractMatrix (STMatrix m) i1 i2 j1 j2 = unsafeIOToST (extractR m 0 (idxs[i1,i2]) 0 (idxs[j1,j2])) |
186 | 189 | ||
187 | -------------------------------------------------------------------------------- | 190 | -------------------------------------------------------------------------------- |
188 | 191 | ||