summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Matrix.hs
diff options
context:
space:
mode:
authorVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-07-09 16:58:11 +0000
committerVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-07-09 16:58:11 +0000
commitebfbc2f82813362e4840d134c57e1c9ce9518c36 (patch)
tree5b4d6a52e44eb36400fea33c8a04854c3de1b1cc /lib/Data/Packed/Matrix.hs
parent48d2f412115b56af091d54c93cee057b1ba7d382 (diff)
generalised linspace
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r--lib/Data/Packed/Matrix.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
index e7ee781..438dabc 100644
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -37,7 +37,7 @@ module Data.Packed.Matrix (
37 37
38import Data.Packed.Internal 38import Data.Packed.Internal
39import qualified Data.Packed.ST as ST 39import qualified Data.Packed.ST as ST
40import Data.Packed.Vector 40--import Data.Packed.Vector
41import Data.Array 41import Data.Array
42import System.Process(readProcess) 42import System.Process(readProcess)
43import Text.Printf(printf) 43import Text.Printf(printf)
@@ -113,7 +113,7 @@ adaptBlocks ms = ms' where
113 113
114 g [Just nr,Just nc] m 114 g [Just nr,Just nc] m
115 | nr == r && nc == c = m 115 | nr == r && nc == c = m
116 | r == 1 && c == 1 = reshape nc (constant x (nr*nc)) 116 | r == 1 && c == 1 = reshape nc (constantD x (nr*nc))
117 | r == 1 = fromRows (replicate nr (flatten m)) 117 | r == 1 = fromRows (replicate nr (flatten m))
118 | otherwise = fromColumns (replicate nc (flatten m)) 118 | otherwise = fromColumns (replicate nc (flatten m))
119 where 119 where
@@ -165,7 +165,7 @@ takeDiag m = fromList [flatten m `at` (k*cols m+k) | k <- [0 .. min (rows m) (co
165 165
166-- | creates the identity matrix of given dimension 166-- | creates the identity matrix of given dimension
167ident :: Element a => Int -> Matrix a 167ident :: Element a => Int -> Matrix a
168ident n = diag (constant 1 n) 168ident n = diag (constantD 1 n)
169 169
170------------------------------------------------------------ 170------------------------------------------------------------
171 171
@@ -459,7 +459,7 @@ class (Element e) => Container c e where
459instance Container Vector Float where 459instance Container Vector Float where
460 toComplex = toComplexV 460 toComplex = toComplexV
461 fromComplex = fromComplexV 461 fromComplex = fromComplexV
462 comp v = toComplex (v,constant 0 (dim v)) 462 comp v = toComplex (v,constantD 0 (dim v))
463 conj = conjV 463 conj = conjV
464 real = mapVector realToFrac 464 real = mapVector realToFrac
465 complex = (mapVector (\(r :+ i) -> (realToFrac r :+ realToFrac i))) . comp 465 complex = (mapVector (\(r :+ i) -> (realToFrac r :+ realToFrac i))) . comp
@@ -467,7 +467,7 @@ instance Container Vector Float where
467instance Container Vector Double where 467instance Container Vector Double where
468 toComplex = toComplexV 468 toComplex = toComplexV
469 fromComplex = fromComplexV 469 fromComplex = fromComplexV
470 comp v = toComplex (v,constant 0 (dim v)) 470 comp v = toComplex (v,constantD 0 (dim v))
471 conj = conjV 471 conj = conjV
472 real = id 472 real = id
473 complex = comp 473 complex = comp