summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Matrix.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-11-05 11:02:45 +0000
committerAlberto Ruiz <aruiz@um.es>2008-11-05 11:02:45 +0000
commit21e13ae0a13befb5cb8feb7c52bcd4b4e4cda953 (patch)
treedc41066b6fd545d76a6fa3114f1d5cf3473a642c /lib/Data/Packed/Internal/Matrix.hs
parent02805ad64715373347b34bac2f75cbb866563ba2 (diff)
diag using ST
Diffstat (limited to 'lib/Data/Packed/Internal/Matrix.hs')
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs25
1 files changed, 0 insertions, 25 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index 63f0a8d..51fb6f8 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -213,19 +213,16 @@ class (Storable a, Floating a) => Element a where
213 subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position 213 subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position
214 -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix 214 -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix
215 -> Matrix a -> Matrix a 215 -> Matrix a -> Matrix a
216 diagD :: Vector a -> Matrix a
217 216
218instance Element Double where 217instance Element Double where
219 constantD = constantR 218 constantD = constantR
220 transdata = transdataR 219 transdata = transdataR
221 subMatrixD = subMatrixR 220 subMatrixD = subMatrixR
222 diagD = diagR
223 221
224instance Element (Complex Double) where 222instance Element (Complex Double) where
225 constantD = constantC 223 constantD = constantC
226 transdata = transdataC 224 transdata = transdataC
227 subMatrixD = subMatrixC 225 subMatrixD = subMatrixC
228 diagD = diagC
229 226
230------------------------------------------------------------------ 227------------------------------------------------------------------
231 228
@@ -287,28 +284,6 @@ subMatrix :: Element a
287 -> Matrix a -- ^ result 284 -> Matrix a -- ^ result
288subMatrix = subMatrixD 285subMatrix = subMatrixD
289 286
290
291---------------------------------------------------------------------
292
293diagAux fun msg (v@V {dim = n}) = unsafePerformIO $ do
294 m <- createMatrix RowMajor n n
295 app2 fun vec v mat m msg
296 return m
297
298-- | diagonal matrix from a real vector
299diagR :: Vector Double -> Matrix Double
300diagR = diagAux c_diagR "diagR"
301foreign import ccall "auxi.h diagR" c_diagR :: TVM
302
303-- | diagonal matrix from a real vector
304diagC :: Vector (Complex Double) -> Matrix (Complex Double)
305diagC = diagAux c_diagC "diagC"
306foreign import ccall "auxi.h diagC" c_diagC :: TCVCM
307
308-- | creates a square matrix with the given diagonal
309diag :: Element a => Vector a -> Matrix a
310diag = diagD
311
312------------------------------------------------------------------------ 287------------------------------------------------------------------------
313 288
314constantAux fun x n = unsafePerformIO $ do 289constantAux fun x n = unsafePerformIO $ do