summaryrefslogtreecommitdiff
path: root/packages/hmatrix
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-05-08 13:43:07 +0200
committerAlberto Ruiz <aruiz@um.es>2014-05-08 13:43:07 +0200
commit551cf7498c33bc0948bb4cb8444ae6f8af7278ea (patch)
treeec86ff73151746f5e13b83549ea5c60ed442764d /packages/hmatrix
parent561a6c0e21bb77c21114ccbbd86d3af5ddb5a3f1 (diff)
separation ok
Diffstat (limited to 'packages/hmatrix')
-rw-r--r--packages/hmatrix/hmatrix.cabal37
-rw-r--r--packages/hmatrix/src/Numeric/Container.hs14
-rw-r--r--packages/hmatrix/src/Numeric/ContainerBoot.hs12
-rw-r--r--packages/hmatrix/src/Numeric/GSL.hs8
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Differentiation.hs12
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Fitting.hs9
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Fourier.hs15
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Integration.hs12
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Internal.hs62
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Minimization.hs25
-rw-r--r--packages/hmatrix/src/Numeric/GSL/ODE.hs10
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Polynomials.hs17
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Root.hs14
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Vector.hs133
-rw-r--r--packages/hmatrix/src/Numeric/IO.hs3
-rw-r--r--packages/hmatrix/src/Numeric/LinearAlgebra/Algorithms.hs4
16 files changed, 256 insertions, 131 deletions
diff --git a/packages/hmatrix/hmatrix.cabal b/packages/hmatrix/hmatrix.cabal
index afd678f..8496663 100644
--- a/packages/hmatrix/hmatrix.cabal
+++ b/packages/hmatrix/hmatrix.cabal
@@ -6,11 +6,11 @@ Author: Alberto Ruiz
6Maintainer: Alberto Ruiz <aruiz@um.es> 6Maintainer: Alberto Ruiz <aruiz@um.es>
7Stability: provisional 7Stability: provisional
8Homepage: https://github.com/albertoruiz/hmatrix 8Homepage: https://github.com/albertoruiz/hmatrix
9Synopsis: Linear algebra and numerical computation 9Synopsis: Numerical computation
10Description: Purely functional interface to basic linear algebra 10Description: Purely functional interface to basic linear algebra
11 and other numerical computations, internally implemented using 11 and other numerical computations, internally implemented using
12 GSL, BLAS and LAPACK. 12 GSL, BLAS and LAPACK.
13 13
14Category: Math 14Category: Math
15tested-with: GHC ==7.8 15tested-with: GHC ==7.8
16 16
@@ -45,8 +45,7 @@ extra-source-files: examples/deriv.hs
45 examples/bool.hs 45 examples/bool.hs
46 examples/multiply.hs 46 examples/multiply.hs
47 47
48extra-source-files: src/Numeric/LinearAlgebra/LAPACK/lapack-aux.h, 48extra-source-files: src/Numeric/GSL/gsl-ode.c
49 src/Numeric/GSL/gsl-ode.c
50 49
51flag dd 50flag dd
52 description: svd = zgesdd 51 description: svd = zgesdd
@@ -74,23 +73,15 @@ flag debugnan
74 73
75library 74library
76 75
77 Build-Depends: base, hmatrix-base, 76 Build-Depends: base, hmatrix-base, array, vector,
78 array, 77 process, random
79 storable-complex, 78
80 process, random,
81 vector >= 0.8,
82 binary,
83 deepseq
84 79
85 Extensions: ForeignFunctionInterface, 80 Extensions: ForeignFunctionInterface,
86 CPP 81 CPP
87 82
88 hs-source-dirs: src 83 hs-source-dirs: src
89 Exposed-modules: Data.Packed, 84 Exposed-modules: Numeric.GSL.Differentiation,
90 Data.Packed.Vector,
91 Data.Packed.Matrix,
92 Data.Packed.Foreign,
93 Numeric.GSL.Differentiation,
94 Numeric.GSL.Integration, 85 Numeric.GSL.Integration,
95 Numeric.GSL.Fourier, 86 Numeric.GSL.Fourier,
96 Numeric.GSL.Polynomials, 87 Numeric.GSL.Polynomials,
@@ -101,24 +92,15 @@ library
101 Numeric.GSL, 92 Numeric.GSL,
102 Numeric.Container, 93 Numeric.Container,
103 Numeric.LinearAlgebra, 94 Numeric.LinearAlgebra,
104 Numeric.LinearAlgebra.LAPACK,
105 Numeric.LinearAlgebra.Algorithms, 95 Numeric.LinearAlgebra.Algorithms,
106 Numeric.LinearAlgebra.Util, 96 Numeric.LinearAlgebra.Util,
107 Data.Packed.ST,
108 Data.Packed.Development
109 Graphics.Plot, 97 Graphics.Plot,
110 Numeric.HMatrix, 98 Numeric.HMatrix,
111 Numeric.HMatrix.Data, 99 Numeric.HMatrix.Data,
112 Numeric.HMatrix.Devel 100 Numeric.HMatrix.Devel
113 other-modules: Data.Packed.Internal, 101 other-modules: Numeric.Random,
114 Data.Packed.Internal.Common,
115 Data.Packed.Internal.Signatures,
116 Data.Packed.Internal.Vector,
117 Data.Packed.Internal.Matrix,
118 Numeric.Random,
119 Numeric.GSL.Internal, 102 Numeric.GSL.Internal,
120 Numeric.GSL.Vector, 103 Numeric.GSL.Vector,
121 Numeric.Conversion,
122 Numeric.ContainerBoot, 104 Numeric.ContainerBoot,
123 Numeric.IO, 105 Numeric.IO,
124 Numeric.Chain, 106 Numeric.Chain,
@@ -127,8 +109,7 @@ library
127 Numeric.LinearAlgebra.Util.Convolution 109 Numeric.LinearAlgebra.Util.Convolution
128 110
129 111
130 C-sources: src/Numeric/LinearAlgebra/LAPACK/lapack-aux.c, 112 C-sources: src/Numeric/GSL/gsl-aux.c
131 src/Numeric/GSL/gsl-aux.c
132 113
133 cc-options: -O4 -msse2 -Wall 114 cc-options: -O4 -msse2 -Wall
134 115
diff --git a/packages/hmatrix/src/Numeric/Container.hs b/packages/hmatrix/src/Numeric/Container.hs
index ff649b7..3a8dd94 100644
--- a/packages/hmatrix/src/Numeric/Container.hs
+++ b/packages/hmatrix/src/Numeric/Container.hs
@@ -30,7 +30,7 @@ module Numeric.Container (
30 -- * Basic functions 30 -- * Basic functions
31 module Data.Packed, 31 module Data.Packed,
32 konst, build, 32 konst, build,
33 constant, linspace, 33 linspace,
34 diag, ident, 34 diag, ident,
35 ctrans, 35 ctrans,
36 -- * Generic operations 36 -- * Generic operations
@@ -64,8 +64,7 @@ module Numeric.Container (
64 fscanfVector, fprintfVector, freadVector, fwriteVector, 64 fscanfVector, fprintfVector, freadVector, fwriteVector,
65) where 65) where
66 66
67import Data.Packed 67import Data.Packed hiding (stepD, stepF, condD, condF, conjugateC, conjugateQ)
68import Data.Packed.Internal(constantD)
69import Numeric.ContainerBoot 68import Numeric.ContainerBoot
70import Numeric.Chain 69import Numeric.Chain
71import Numeric.IO 70import Numeric.IO
@@ -75,15 +74,6 @@ import Numeric.Random
75 74
76------------------------------------------------------------------ 75------------------------------------------------------------------
77 76
78{- | creates a vector with a given number of equal components:
79
80@> constant 2 7
817 |> [2.0,2.0,2.0,2.0,2.0,2.0,2.0]@
82-}
83constant :: Element a => a -> Int -> Vector a
84-- constant x n = runSTVector (newVector x n)
85constant = constantD-- about 2x faster
86
87{- | Creates a real vector containing a range of values: 77{- | Creates a real vector containing a range of values:
88 78
89>>> linspace 5 (-3,7::Double) 79>>> linspace 5 (-3,7::Double)
diff --git a/packages/hmatrix/src/Numeric/ContainerBoot.hs b/packages/hmatrix/src/Numeric/ContainerBoot.hs
index ea4262c..ef21763 100644
--- a/packages/hmatrix/src/Numeric/ContainerBoot.hs
+++ b/packages/hmatrix/src/Numeric/ContainerBoot.hs
@@ -42,7 +42,7 @@ module Numeric.ContainerBoot (
42import Data.Packed 42import Data.Packed
43import Data.Packed.ST as ST 43import Data.Packed.ST as ST
44import Numeric.Conversion 44import Numeric.Conversion
45import Data.Packed.Internal 45import Data.Packed.Development
46import Numeric.GSL.Vector 46import Numeric.GSL.Vector
47import Data.Complex 47import Data.Complex
48import Control.Applicative((<*>)) 48import Control.Applicative((<*>))
@@ -201,7 +201,7 @@ instance Container Vector Float where
201 equal u v = dim u == dim v && maxElement (vectorMapF Abs (sub u v)) == 0.0 201 equal u v = dim u == dim v && maxElement (vectorMapF Abs (sub u v)) == 0.0
202 arctan2 = vectorZipF ATan2 202 arctan2 = vectorZipF ATan2
203 scalar x = fromList [x] 203 scalar x = fromList [x]
204 konst' = constantD 204 konst' = constant
205 build' = buildV 205 build' = buildV
206 conj = id 206 conj = id
207 cmap = mapVector 207 cmap = mapVector
@@ -229,7 +229,7 @@ instance Container Vector Double where
229 equal u v = dim u == dim v && maxElement (vectorMapR Abs (sub u v)) == 0.0 229 equal u v = dim u == dim v && maxElement (vectorMapR Abs (sub u v)) == 0.0
230 arctan2 = vectorZipR ATan2 230 arctan2 = vectorZipR ATan2
231 scalar x = fromList [x] 231 scalar x = fromList [x]
232 konst' = constantD 232 konst' = constant
233 build' = buildV 233 build' = buildV
234 conj = id 234 conj = id
235 cmap = mapVector 235 cmap = mapVector
@@ -257,7 +257,7 @@ instance Container Vector (Complex Double) where
257 equal u v = dim u == dim v && maxElement (mapVector magnitude (sub u v)) == 0.0 257 equal u v = dim u == dim v && maxElement (mapVector magnitude (sub u v)) == 0.0
258 arctan2 = vectorZipC ATan2 258 arctan2 = vectorZipC ATan2
259 scalar x = fromList [x] 259 scalar x = fromList [x]
260 konst' = constantD 260 konst' = constant
261 build' = buildV 261 build' = buildV
262 conj = conjugateC 262 conj = conjugateC
263 cmap = mapVector 263 cmap = mapVector
@@ -285,7 +285,7 @@ instance Container Vector (Complex Float) where
285 equal u v = dim u == dim v && maxElement (mapVector magnitude (sub u v)) == 0.0 285 equal u v = dim u == dim v && maxElement (mapVector magnitude (sub u v)) == 0.0
286 arctan2 = vectorZipQ ATan2 286 arctan2 = vectorZipQ ATan2
287 scalar x = fromList [x] 287 scalar x = fromList [x]
288 konst' = constantD 288 konst' = constant
289 build' = buildV 289 build' = buildV
290 conj = conjugateQ 290 conj = conjugateQ
291 cmap = mapVector 291 cmap = mapVector
@@ -569,7 +569,7 @@ diag v = diagRect 0 v n n where n = dim v
569 569
570-- | creates the identity matrix of given dimension 570-- | creates the identity matrix of given dimension
571ident :: (Num a, Element a) => Int -> Matrix a 571ident :: (Num a, Element a) => Int -> Matrix a
572ident n = diag (constantD 1 n) 572ident n = diag (constant 1 n)
573 573
574-------------------------------------------------------- 574--------------------------------------------------------
575 575
diff --git a/packages/hmatrix/src/Numeric/GSL.hs b/packages/hmatrix/src/Numeric/GSL.hs
index 5f39a3e..61b8d7b 100644
--- a/packages/hmatrix/src/Numeric/GSL.hs
+++ b/packages/hmatrix/src/Numeric/GSL.hs
@@ -1,12 +1,11 @@
1{- | 1{- |
2 2
3Module : Numeric.GSL 3Module : Numeric.GSL
4Copyright : (c) Alberto Ruiz 2006-7 4Copyright : (c) Alberto Ruiz 2006-14
5License : GPL-style 5License : GPL
6 6
7Maintainer : Alberto Ruiz (aruiz at um dot es) 7Maintainer : Alberto Ruiz
8Stability : provisional 8Stability : provisional
9Portability : uses -fffi and -fglasgow-exts
10 9
11This module reexports all available GSL functions. 10This module reexports all available GSL functions.
12 11
@@ -41,3 +40,4 @@ import Data.Complex
41-- | This action removes the GSL default error handler (which aborts the program), so that 40-- | This action removes the GSL default error handler (which aborts the program), so that
42-- GSL errors can be handled by Haskell (using Control.Exception) and ghci doesn't abort. 41-- GSL errors can be handled by Haskell (using Control.Exception) and ghci doesn't abort.
43foreign import ccall unsafe "GSL/gsl-aux.h no_abort_on_error" setErrorHandlerOff :: IO () 42foreign import ccall unsafe "GSL/gsl-aux.h no_abort_on_error" setErrorHandlerOff :: IO ()
43
diff --git a/packages/hmatrix/src/Numeric/GSL/Differentiation.hs b/packages/hmatrix/src/Numeric/GSL/Differentiation.hs
index 93c5007..0fb58ef 100644
--- a/packages/hmatrix/src/Numeric/GSL/Differentiation.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Differentiation.hs
@@ -1,13 +1,10 @@
1{-# OPTIONS #-}
2-----------------------------------------------------------------------------
3{- | 1{- |
4Module : Numeric.GSL.Differentiation 2Module : Numeric.GSL.Differentiation
5Copyright : (c) Alberto Ruiz 2006 3Copyright : (c) Alberto Ruiz 2006
6License : GPL-style 4License : GPL
7 5
8Maintainer : Alberto Ruiz (aruiz at um dot es) 6Maintainer : Alberto Ruiz
9Stability : provisional 7Stability : provisional
10Portability : uses ffi
11 8
12Numerical differentiation. 9Numerical differentiation.
13 10
@@ -15,7 +12,8 @@ Numerical differentiation.
15 12
16From the GSL manual: \"The functions described in this chapter compute numerical derivatives by finite differencing. An adaptive algorithm is used to find the best choice of finite difference and to estimate the error in the derivative.\" 13From the GSL manual: \"The functions described in this chapter compute numerical derivatives by finite differencing. An adaptive algorithm is used to find the best choice of finite difference and to estimate the error in the derivative.\"
17-} 14-}
18----------------------------------------------------------------------------- 15
16
19module Numeric.GSL.Differentiation ( 17module Numeric.GSL.Differentiation (
20 derivCentral, 18 derivCentral,
21 derivForward, 19 derivForward,
@@ -26,7 +24,7 @@ import Foreign.C.Types
26import Foreign.Marshal.Alloc(malloc, free) 24import Foreign.Marshal.Alloc(malloc, free)
27import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) 25import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr)
28import Foreign.Storable(peek) 26import Foreign.Storable(peek)
29import Data.Packed.Internal(check,(//)) 27import Numeric.GSL.Internal
30import System.IO.Unsafe(unsafePerformIO) 28import System.IO.Unsafe(unsafePerformIO)
31 29
32derivGen :: 30derivGen ::
diff --git a/packages/hmatrix/src/Numeric/GSL/Fitting.hs b/packages/hmatrix/src/Numeric/GSL/Fitting.hs
index c4f3a91..0a92373 100644
--- a/packages/hmatrix/src/Numeric/GSL/Fitting.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Fitting.hs
@@ -3,9 +3,8 @@ Module : Numeric.GSL.Fitting
3Copyright : (c) Alberto Ruiz 2010 3Copyright : (c) Alberto Ruiz 2010
4License : GPL 4License : GPL
5 5
6Maintainer : Alberto Ruiz (aruiz at um dot es) 6Maintainer : Alberto Ruiz
7Stability : provisional 7Stability : provisional
8Portability : uses ffi
9 8
10Nonlinear Least-Squares Fitting 9Nonlinear Least-Squares Fitting
11 10
@@ -42,7 +41,7 @@ expModelDer [a,lambda,b] [t] = [[exp (-lambda * t), -t * a * exp(-lambda*t) , 1]
42(1.0192487112786812,3.782067731353722e-2)] 41(1.0192487112786812,3.782067731353722e-2)]
43 42
44-} 43-}
45----------------------------------------------------------------------------- 44
46 45
47module Numeric.GSL.Fitting ( 46module Numeric.GSL.Fitting (
48 -- * Levenberg-Marquardt 47 -- * Levenberg-Marquardt
@@ -51,7 +50,6 @@ module Numeric.GSL.Fitting (
51 fitModelScaled, fitModel 50 fitModelScaled, fitModel
52) where 51) where
53 52
54import Data.Packed.Internal
55import Numeric.LinearAlgebra 53import Numeric.LinearAlgebra
56import Numeric.GSL.Internal 54import Numeric.GSL.Internal
57 55
@@ -61,6 +59,9 @@ import System.IO.Unsafe(unsafePerformIO)
61 59
62------------------------------------------------------------------------- 60-------------------------------------------------------------------------
63 61
62type TVV = TV (TV Res)
63type TVM = TV (TM Res)
64
64data FittingMethod = LevenbergMarquardtScaled -- ^ Interface to gsl_multifit_fdfsolver_lmsder. This is a robust and efficient version of the Levenberg-Marquardt algorithm as implemented in the scaled lmder routine in minpack. Minpack was written by Jorge J. More, Burton S. Garbow and Kenneth E. Hillstrom. 65data FittingMethod = LevenbergMarquardtScaled -- ^ Interface to gsl_multifit_fdfsolver_lmsder. This is a robust and efficient version of the Levenberg-Marquardt algorithm as implemented in the scaled lmder routine in minpack. Minpack was written by Jorge J. More, Burton S. Garbow and Kenneth E. Hillstrom.
65 | LevenbergMarquardt -- ^ This is an unscaled version of the lmder algorithm. The elements of the diagonal scaling matrix D are set to 1. This algorithm may be useful in circumstances where the scaled version of lmder converges too slowly, or the function is already scaled appropriately. 66 | LevenbergMarquardt -- ^ This is an unscaled version of the lmder algorithm. The elements of the diagonal scaling matrix D are set to 1. This algorithm may be useful in circumstances where the scaled version of lmder converges too slowly, or the function is already scaled appropriately.
66 deriving (Enum,Eq,Show,Bounded) 67 deriving (Enum,Eq,Show,Bounded)
diff --git a/packages/hmatrix/src/Numeric/GSL/Fourier.hs b/packages/hmatrix/src/Numeric/GSL/Fourier.hs
index 86aedd6..734325b 100644
--- a/packages/hmatrix/src/Numeric/GSL/Fourier.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Fourier.hs
@@ -1,26 +1,23 @@
1{-# LANGUAGE ForeignFunctionInterface #-}
2-----------------------------------------------------------------------------
3{- | 1{- |
4Module : Numeric.GSL.Fourier 2Module : Numeric.GSL.Fourier
5Copyright : (c) Alberto Ruiz 2006 3Copyright : (c) Alberto Ruiz 2006
6License : GPL-style 4License : GPL
7 5Maintainer : Alberto Ruiz
8Maintainer : Alberto Ruiz (aruiz at um dot es)
9Stability : provisional 6Stability : provisional
10Portability : uses ffi
11 7
12Fourier Transform. 8Fourier Transform.
13 9
14<http://www.gnu.org/software/gsl/manual/html_node/Fast-Fourier-Transforms.html#Fast-Fourier-Transforms> 10<http://www.gnu.org/software/gsl/manual/html_node/Fast-Fourier-Transforms.html#Fast-Fourier-Transforms>
15 11
16-} 12-}
17----------------------------------------------------------------------------- 13
18module Numeric.GSL.Fourier ( 14module Numeric.GSL.Fourier (
19 fft, 15 fft,
20 ifft 16 ifft
21) where 17) where
22 18
23import Data.Packed.Internal 19import Data.Packed
20import Numeric.GSL.Internal
24import Data.Complex 21import Data.Complex
25import Foreign.C.Types 22import Foreign.C.Types
26import System.IO.Unsafe (unsafePerformIO) 23import System.IO.Unsafe (unsafePerformIO)
@@ -30,7 +27,7 @@ genfft code v = unsafePerformIO $ do
30 app2 (c_fft code) vec v vec r "fft" 27 app2 (c_fft code) vec v vec r "fft"
31 return r 28 return r
32 29
33foreign import ccall unsafe "gsl-aux.h fft" c_fft :: CInt -> TCVCV 30foreign import ccall unsafe "gsl-aux.h fft" c_fft :: CInt -> TCV (TCV Res)
34 31
35 32
36{- | Fast 1D Fourier transform of a 'Vector' @(@'Complex' 'Double'@)@ using /gsl_fft_complex_forward/. It uses the same scaling conventions as GNU Octave. 33{- | Fast 1D Fourier transform of a 'Vector' @(@'Complex' 'Double'@)@ using /gsl_fft_complex_forward/. It uses the same scaling conventions as GNU Octave.
diff --git a/packages/hmatrix/src/Numeric/GSL/Integration.hs b/packages/hmatrix/src/Numeric/GSL/Integration.hs
index 5f0a415..9c1d43a 100644
--- a/packages/hmatrix/src/Numeric/GSL/Integration.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Integration.hs
@@ -1,19 +1,15 @@
1{-# OPTIONS #-}
2-----------------------------------------------------------------------------
3{- | 1{- |
4Module : Numeric.GSL.Integration 2Module : Numeric.GSL.Integration
5Copyright : (c) Alberto Ruiz 2006 3Copyright : (c) Alberto Ruiz 2006
6License : GPL-style 4License : GPL
7 5Maintainer : Alberto Ruiz
8Maintainer : Alberto Ruiz (aruiz at um dot es)
9Stability : provisional 6Stability : provisional
10Portability : uses ffi
11 7
12Numerical integration routines. 8Numerical integration routines.
13 9
14<http://www.gnu.org/software/gsl/manual/html_node/Numerical-Integration.html#Numerical-Integration> 10<http://www.gnu.org/software/gsl/manual/html_node/Numerical-Integration.html#Numerical-Integration>
15-} 11-}
16----------------------------------------------------------------------------- 12
17 13
18module Numeric.GSL.Integration ( 14module Numeric.GSL.Integration (
19 integrateQNG, 15 integrateQNG,
@@ -28,7 +24,7 @@ import Foreign.C.Types
28import Foreign.Marshal.Alloc(malloc, free) 24import Foreign.Marshal.Alloc(malloc, free)
29import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) 25import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr)
30import Foreign.Storable(peek) 26import Foreign.Storable(peek)
31import Data.Packed.Internal(check,(//)) 27import Numeric.GSL.Internal
32import System.IO.Unsafe(unsafePerformIO) 28import System.IO.Unsafe(unsafePerformIO)
33 29
34eps = 1e-12 30eps = 1e-12
diff --git a/packages/hmatrix/src/Numeric/GSL/Internal.hs b/packages/hmatrix/src/Numeric/GSL/Internal.hs
index 69a9750..a1c4e0c 100644
--- a/packages/hmatrix/src/Numeric/GSL/Internal.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Internal.hs
@@ -1,23 +1,43 @@
1-- |
1-- Module : Numeric.GSL.Internal 2-- Module : Numeric.GSL.Internal
2-- Copyright : (c) Alberto Ruiz 2009 3-- Copyright : (c) Alberto Ruiz 2009
3-- License : GPL 4-- License : GPL
4-- 5-- Maintainer : Alberto Ruiz
5-- Maintainer : Alberto Ruiz (aruiz at um dot es)
6-- Stability : provisional 6-- Stability : provisional
7-- Portability : uses ffi 7--
8-- 8--
9-- Auxiliary functions. 9-- Auxiliary functions.
10-- 10--
11-- #hide
12 11
13module Numeric.GSL.Internal where
14 12
15import Data.Packed.Internal 13module Numeric.GSL.Internal(
14 iv,
15 mkVecfun,
16 mkVecVecfun,
17 mkDoubleVecVecfun,
18 mkDoublefun,
19 aux_vTov,
20 mkVecMatfun,
21 mkDoubleVecMatfun,
22 aux_vTom,
23 createV,
24 createMIO,
25 module Data.Packed.Development,
26 check,
27 Res,TV,TM,TCV,TCM
28) where
29
30import Data.Packed
31import Data.Packed.Development hiding (check)
32import Data.Complex
16 33
17import Foreign.Marshal.Array(copyArray) 34import Foreign.Marshal.Array(copyArray)
18import Foreign.Ptr(Ptr, FunPtr) 35import Foreign.Ptr(Ptr, FunPtr)
19import Foreign.C.Types 36import Foreign.C.Types
37import Foreign.C.String(peekCString)
20import System.IO.Unsafe(unsafePerformIO) 38import System.IO.Unsafe(unsafePerformIO)
39import Data.Vector.Storable(unsafeWith)
40import Control.Monad(when)
21 41
22iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double) 42iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double)
23iv f n p = f (createV (fromIntegral n) copy "iv") where 43iv f n p = f (createV (fromIntegral n) copy "iv") where
@@ -74,3 +94,33 @@ createMIO r c fun msg = do
74 res <- createMatrix RowMajor r c 94 res <- createMatrix RowMajor r c
75 app1 fun mat res msg 95 app1 fun mat res msg
76 return res 96 return res
97
98--------------------------------------------------------------------------------
99
100-- | check the error code
101check :: String -> IO CInt -> IO ()
102check msg f = do
103 err <- f
104 when (err/=0) $ do
105 ps <- gsl_strerror err
106 s <- peekCString ps
107 error (msg++": "++s)
108 return ()
109
110-- | description of GSL error codes
111foreign import ccall unsafe "gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar)
112
113type PF = Ptr Float
114type PD = Ptr Double
115type PQ = Ptr (Complex Float)
116type PC = Ptr (Complex Double)
117
118type Res = IO CInt
119type TV x = CInt -> PD -> x
120type TM x = CInt -> CInt -> PD -> x
121type TCV x = CInt -> PC -> x
122type TCM x = CInt -> CInt -> PC -> x
123
124type TVV = TV (TV Res)
125type TVM = TV (TM Res)
126
diff --git a/packages/hmatrix/src/Numeric/GSL/Minimization.hs b/packages/hmatrix/src/Numeric/GSL/Minimization.hs
index 1879dab..056d463 100644
--- a/packages/hmatrix/src/Numeric/GSL/Minimization.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Minimization.hs
@@ -1,13 +1,9 @@
1{-# LANGUAGE ForeignFunctionInterface #-}
2-----------------------------------------------------------------------------
3{- | 1{- |
4Module : Numeric.GSL.Minimization 2Module : Numeric.GSL.Minimization
5Copyright : (c) Alberto Ruiz 2006-9 3Copyright : (c) Alberto Ruiz 2006-9
6License : GPL-style 4License : GPL
7 5Maintainer : Alberto Ruiz
8Maintainer : Alberto Ruiz (aruiz at um dot es)
9Stability : provisional 6Stability : provisional
10Portability : uses ffi
11 7
12Minimization of a multidimensional function using some of the algorithms described in: 8Minimization of a multidimensional function using some of the algorithms described in:
13 9
@@ -48,7 +44,7 @@ The nmsimplex2 version is a new O(N) implementation of the earlier O(N^2) nmsimp
48 44
49-} 45-}
50 46
51----------------------------------------------------------------------------- 47
52module Numeric.GSL.Minimization ( 48module Numeric.GSL.Minimization (
53 minimize, minimizeV, MinimizeMethod(..), 49 minimize, minimizeV, MinimizeMethod(..),
54 minimizeD, minimizeVD, MinimizeMethodD(..), 50 minimizeD, minimizeVD, MinimizeMethodD(..),
@@ -60,8 +56,7 @@ module Numeric.GSL.Minimization (
60) where 56) where
61 57
62 58
63import Data.Packed.Internal 59import Data.Packed
64import Data.Packed.Matrix
65import Numeric.GSL.Internal 60import Numeric.GSL.Internal
66 61
67import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) 62import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr)
@@ -112,7 +107,7 @@ uniMinimizeGen m f xmin xl xu epsrel maxit = unsafePerformIO $ do
112 107
113 108
114foreign import ccall safe "uniMinimize" 109foreign import ccall safe "uniMinimize"
115 c_uniMinize:: CInt -> FunPtr (Double -> Double) -> Double -> CInt -> Double -> Double -> Double -> TM 110 c_uniMinize:: CInt -> FunPtr (Double -> Double) -> Double -> CInt -> Double -> Double -> Double -> TM Res
116 111
117data MinimizeMethod = NMSimplex 112data MinimizeMethod = NMSimplex
118 | NMSimplex2 113 | NMSimplex2
@@ -150,13 +145,13 @@ minimizeV method eps maxit szv f xiv = unsafePerformIO $ do
150 "minimize" 145 "minimize"
151 let it = round (rawpath @@> (maxit-1,0)) 146 let it = round (rawpath @@> (maxit-1,0))
152 path = takeRows it rawpath 147 path = takeRows it rawpath
153 sol = cdat $ dropColumns 3 $ dropRows (it-1) path 148 sol = flatten $ dropColumns 3 $ dropRows (it-1) path
154 freeHaskellFunPtr fp 149 freeHaskellFunPtr fp
155 return (sol, path) 150 return (sol, path)
156 151
157 152
158foreign import ccall safe "gsl-aux.h minimize" 153foreign import ccall safe "gsl-aux.h minimize"
159 c_minimize:: CInt -> FunPtr (CInt -> Ptr Double -> Double) -> Double -> CInt -> TVVM 154 c_minimize:: CInt -> FunPtr (CInt -> Ptr Double -> Double) -> Double -> CInt -> TV(TV(TM Res))
160 155
161---------------------------------------------------------------------------------- 156----------------------------------------------------------------------------------
162 157
@@ -207,7 +202,7 @@ minimizeVD method eps maxit istep tol f df xiv = unsafePerformIO $ do
207 "minimizeD" 202 "minimizeD"
208 let it = round (rawpath @@> (maxit-1,0)) 203 let it = round (rawpath @@> (maxit-1,0))
209 path = takeRows it rawpath 204 path = takeRows it rawpath
210 sol = cdat $ dropColumns 2 $ dropRows (it-1) path 205 sol = flatten $ dropColumns 2 $ dropRows (it-1) path
211 freeHaskellFunPtr fp 206 freeHaskellFunPtr fp
212 freeHaskellFunPtr dfp 207 freeHaskellFunPtr dfp
213 return (sol,path) 208 return (sol,path)
@@ -215,9 +210,9 @@ minimizeVD method eps maxit istep tol f df xiv = unsafePerformIO $ do
215foreign import ccall safe "gsl-aux.h minimizeD" 210foreign import ccall safe "gsl-aux.h minimizeD"
216 c_minimizeD :: CInt 211 c_minimizeD :: CInt
217 -> FunPtr (CInt -> Ptr Double -> Double) 212 -> FunPtr (CInt -> Ptr Double -> Double)
218 -> FunPtr TVV 213 -> FunPtr (TV (TV Res))
219 -> Double -> Double -> Double -> CInt 214 -> Double -> Double -> Double -> CInt
220 -> TVM 215 -> TV (TM Res)
221 216
222--------------------------------------------------------------------- 217---------------------------------------------------------------------
223 218
diff --git a/packages/hmatrix/src/Numeric/GSL/ODE.hs b/packages/hmatrix/src/Numeric/GSL/ODE.hs
index 9a29085..7549a65 100644
--- a/packages/hmatrix/src/Numeric/GSL/ODE.hs
+++ b/packages/hmatrix/src/Numeric/GSL/ODE.hs
@@ -2,10 +2,8 @@
2Module : Numeric.GSL.ODE 2Module : Numeric.GSL.ODE
3Copyright : (c) Alberto Ruiz 2010 3Copyright : (c) Alberto Ruiz 2010
4License : GPL 4License : GPL
5 5Maintainer : Alberto Ruiz
6Maintainer : Alberto Ruiz (aruiz at um dot es)
7Stability : provisional 6Stability : provisional
8Portability : uses ffi
9 7
10Solution of ordinary differential equation (ODE) initial value problems. 8Solution of ordinary differential equation (ODE) initial value problems.
11 9
@@ -34,7 +32,7 @@ module Numeric.GSL.ODE (
34 odeSolve, odeSolveV, ODEMethod(..), Jacobian 32 odeSolve, odeSolveV, ODEMethod(..), Jacobian
35) where 33) where
36 34
37import Data.Packed.Internal 35import Data.Packed
38import Numeric.GSL.Internal 36import Numeric.GSL.Internal
39 37
40import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr) 38import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr)
@@ -43,6 +41,10 @@ import System.IO.Unsafe(unsafePerformIO)
43 41
44------------------------------------------------------------------------- 42-------------------------------------------------------------------------
45 43
44type TVV = TV (TV Res)
45type TVM = TV (TM Res)
46type TVVM = TV (TV (TM Res))
47
46type Jacobian = Double -> Vector Double -> Matrix Double 48type Jacobian = Double -> Vector Double -> Matrix Double
47 49
48-- | Stepping functions 50-- | Stepping functions
diff --git a/packages/hmatrix/src/Numeric/GSL/Polynomials.hs b/packages/hmatrix/src/Numeric/GSL/Polynomials.hs
index 290c615..b1be85d 100644
--- a/packages/hmatrix/src/Numeric/GSL/Polynomials.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Polynomials.hs
@@ -1,25 +1,23 @@
1{-# LANGUAGE CPP, ForeignFunctionInterface #-}
2-----------------------------------------------------------------------------
3{- | 1{- |
4Module : Numeric.GSL.Polynomials 2Module : Numeric.GSL.Polynomials
5Copyright : (c) Alberto Ruiz 2006 3Copyright : (c) Alberto Ruiz 2006
6License : GPL-style 4License : GPL
7 5Maintainer : Alberto Ruiz
8Maintainer : Alberto Ruiz (aruiz at um dot es)
9Stability : provisional 6Stability : provisional
10Portability : uses ffi
11 7
12Polynomials. 8Polynomials.
13 9
14<http://www.gnu.org/software/gsl/manual/html_node/General-Polynomial-Equations.html#General-Polynomial-Equations> 10<http://www.gnu.org/software/gsl/manual/html_node/General-Polynomial-Equations.html#General-Polynomial-Equations>
15 11
16-} 12-}
17----------------------------------------------------------------------------- 13
14
18module Numeric.GSL.Polynomials ( 15module Numeric.GSL.Polynomials (
19 polySolve 16 polySolve
20) where 17) where
21 18
22import Data.Packed.Internal 19import Data.Packed
20import Numeric.GSL.Internal
23import Data.Complex 21import Data.Complex
24import System.IO.Unsafe (unsafePerformIO) 22import System.IO.Unsafe (unsafePerformIO)
25 23
@@ -55,4 +53,5 @@ polySolve' v | dim v > 1 = unsafePerformIO $ do
55 return r 53 return r
56 | otherwise = error "polySolve on a polynomial of degree zero" 54 | otherwise = error "polySolve on a polynomial of degree zero"
57 55
58foreign import ccall unsafe "gsl-aux.h polySolve" c_polySolve:: TVCV 56foreign import ccall unsafe "gsl-aux.h polySolve" c_polySolve:: TV (TCV Res)
57
diff --git a/packages/hmatrix/src/Numeric/GSL/Root.hs b/packages/hmatrix/src/Numeric/GSL/Root.hs
index 9d561c4..b9f3b94 100644
--- a/packages/hmatrix/src/Numeric/GSL/Root.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Root.hs
@@ -2,10 +2,8 @@
2Module : Numeric.GSL.Root 2Module : Numeric.GSL.Root
3Copyright : (c) Alberto Ruiz 2009 3Copyright : (c) Alberto Ruiz 2009
4License : GPL 4License : GPL
5 5Maintainer : Alberto Ruiz
6Maintainer : Alberto Ruiz (aruiz at um dot es)
7Stability : provisional 6Stability : provisional
8Portability : uses ffi
9 7
10Multidimensional root finding. 8Multidimensional root finding.
11 9
@@ -41,14 +39,16 @@ module Numeric.GSL.Root (
41 rootJ, RootMethodJ(..), 39 rootJ, RootMethodJ(..),
42) where 40) where
43 41
44import Data.Packed.Internal 42import Data.Packed
45import Data.Packed.Matrix
46import Numeric.GSL.Internal 43import Numeric.GSL.Internal
47import Foreign.Ptr(FunPtr, freeHaskellFunPtr) 44import Foreign.Ptr(FunPtr, freeHaskellFunPtr)
48import Foreign.C.Types 45import Foreign.C.Types
49import System.IO.Unsafe(unsafePerformIO) 46import System.IO.Unsafe(unsafePerformIO)
50 47
51------------------------------------------------------------------------- 48-------------------------------------------------------------------------
49type TVV = TV (TV Res)
50type TVM = TV (TM Res)
51
52 52
53data UniRootMethod = Bisection 53data UniRootMethod = Bisection
54 | FalsePos 54 | FalsePos
@@ -76,7 +76,7 @@ uniRootGen m f xl xu epsrel maxit = unsafePerformIO $ do
76 return (sol !! 1, path) 76 return (sol !! 1, path)
77 77
78foreign import ccall safe "root" 78foreign import ccall safe "root"
79 c_root:: CInt -> FunPtr (Double -> Double) -> Double -> CInt -> Double -> Double -> TM 79 c_root:: CInt -> FunPtr (Double -> Double) -> Double -> CInt -> Double -> Double -> TM Res
80 80
81------------------------------------------------------------------------- 81-------------------------------------------------------------------------
82data UniRootMethodJ = UNewton 82data UniRootMethodJ = UNewton
@@ -108,7 +108,7 @@ uniRootJGen m f df x epsrel maxit = unsafePerformIO $ do
108 108
109foreign import ccall safe "rootj" 109foreign import ccall safe "rootj"
110 c_rootj :: CInt -> FunPtr (Double -> Double) -> FunPtr (Double -> Double) 110 c_rootj :: CInt -> FunPtr (Double -> Double) -> FunPtr (Double -> Double)
111 -> Double -> CInt -> Double -> TM 111 -> Double -> CInt -> Double -> TM Res
112 112
113------------------------------------------------------------------------- 113-------------------------------------------------------------------------
114 114
diff --git a/packages/hmatrix/src/Numeric/GSL/Vector.hs b/packages/hmatrix/src/Numeric/GSL/Vector.hs
index 6204b8e..29c8bb7 100644
--- a/packages/hmatrix/src/Numeric/GSL/Vector.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Vector.hs
@@ -2,11 +2,9 @@
2-- | 2-- |
3-- Module : Numeric.GSL.Vector 3-- Module : Numeric.GSL.Vector
4-- Copyright : (c) Alberto Ruiz 2007 4-- Copyright : (c) Alberto Ruiz 2007
5-- License : GPL-style 5-- License : GPL
6-- 6-- Maintainer : Alberto Ruiz
7-- Maintainer : Alberto Ruiz <aruiz@um.es>
8-- Stability : provisional 7-- Stability : provisional
9-- Portability : portable (uses FFI)
10-- 8--
11-- Low level interface to vector operations. 9-- Low level interface to vector operations.
12-- 10--
@@ -20,18 +18,20 @@ module Numeric.GSL.Vector (
20 FunCodeV(..), vectorMapR, vectorMapC, vectorMapF, vectorMapQ, 18 FunCodeV(..), vectorMapR, vectorMapC, vectorMapF, vectorMapQ,
21 FunCodeSV(..), vectorMapValR, vectorMapValC, vectorMapValF, vectorMapValQ, 19 FunCodeSV(..), vectorMapValR, vectorMapValC, vectorMapValF, vectorMapValQ,
22 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ, 20 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ,
23 RandDist(..), randomVector 21 RandDist(..), randomVector,
22 saveMatrix,
23 fwriteVector, freadVector, fprintfVector, fscanfVector
24) where 24) where
25 25
26import Data.Packed.Internal.Common 26import Data.Packed
27import Data.Packed.Internal.Signatures 27import Numeric.GSL.Internal hiding (TV,TM,TCV,TCM)
28import Data.Packed.Internal.Vector
29 28
30import Data.Complex 29import Data.Complex
31import Foreign.Marshal.Alloc(free) 30import Foreign.Marshal.Alloc(free)
32import Foreign.Marshal.Array(newArray) 31import Foreign.Marshal.Array(newArray)
33import Foreign.Ptr(Ptr) 32import Foreign.Ptr(Ptr)
34import Foreign.C.Types 33import Foreign.C.Types
34import Foreign.C.String(newCString)
35import System.IO.Unsafe(unsafePerformIO) 35import System.IO.Unsafe(unsafePerformIO)
36import Control.Monad(when) 36import Control.Monad(when)
37 37
@@ -186,7 +186,7 @@ foreign import ccall unsafe "gsl-aux.h dotC" c_dotC :: TCVCVCV
186toScalarAux fun code v = unsafePerformIO $ do 186toScalarAux fun code v = unsafePerformIO $ do
187 r <- createVector 1 187 r <- createVector 1
188 app2 (fun (fromei code)) vec v vec r "toScalarAux" 188 app2 (fun (fromei code)) vec v vec r "toScalarAux"
189 return (r `at` 0) 189 return (r @> 0)
190 190
191vectorMapAux fun code v = unsafePerformIO $ do 191vectorMapAux fun code v = unsafePerformIO $ do
192 r <- createVector (dim v) 192 r <- createVector (dim v)
@@ -326,3 +326,118 @@ randomVector seed dist n = unsafePerformIO $ do
326 return r 326 return r
327 327
328foreign import ccall unsafe "random_vector" c_random_vector :: CInt -> CInt -> TV 328foreign import ccall unsafe "random_vector" c_random_vector :: CInt -> CInt -> TV
329
330--------------------------------------------------------------------------------
331
332-- | Saves a matrix as 2D ASCII table.
333saveMatrix :: FilePath
334 -> String -- ^ format (%f, %g, %e)
335 -> Matrix Double
336 -> IO ()
337saveMatrix filename fmt m = do
338 charname <- newCString filename
339 charfmt <- newCString fmt
340 let o = if orderOf m == RowMajor then 1 else 0
341 app1 (matrix_fprintf charname charfmt o) mat m "matrix_fprintf"
342 free charname
343 free charfmt
344
345foreign import ccall unsafe "matrix_fprintf" matrix_fprintf :: Ptr CChar -> Ptr CChar -> CInt -> TM
346
347--------------------------------------------------------------------------------
348
349-- | Loads a vector from an ASCII file (the number of elements must be known in advance).
350fscanfVector :: FilePath -> Int -> IO (Vector Double)
351fscanfVector filename n = do
352 charname <- newCString filename
353 res <- createVector n
354 app1 (gsl_vector_fscanf charname) vec res "gsl_vector_fscanf"
355 free charname
356 return res
357
358foreign import ccall unsafe "vector_fscanf" gsl_vector_fscanf:: Ptr CChar -> TV
359
360-- | Saves the elements of a vector, with a given format (%f, %e, %g), to an ASCII file.
361fprintfVector :: FilePath -> String -> Vector Double -> IO ()
362fprintfVector filename fmt v = do
363 charname <- newCString filename
364 charfmt <- newCString fmt
365 app1 (gsl_vector_fprintf charname charfmt) vec v "gsl_vector_fprintf"
366 free charname
367 free charfmt
368
369foreign import ccall unsafe "vector_fprintf" gsl_vector_fprintf :: Ptr CChar -> Ptr CChar -> TV
370
371-- | Loads a vector from a binary file (the number of elements must be known in advance).
372freadVector :: FilePath -> Int -> IO (Vector Double)
373freadVector filename n = do
374 charname <- newCString filename
375 res <- createVector n
376 app1 (gsl_vector_fread charname) vec res "gsl_vector_fread"
377 free charname
378 return res
379
380foreign import ccall unsafe "vector_fread" gsl_vector_fread:: Ptr CChar -> TV
381
382-- | Saves the elements of a vector to a binary file.
383fwriteVector :: FilePath -> Vector Double -> IO ()
384fwriteVector filename v = do
385 charname <- newCString filename
386 app1 (gsl_vector_fwrite charname) vec v "gsl_vector_fwrite"
387 free charname
388
389foreign import ccall unsafe "vector_fwrite" gsl_vector_fwrite :: Ptr CChar -> TV
390
391type PF = Ptr Float --
392type PD = Ptr Double --
393type PQ = Ptr (Complex Float) --
394type PC = Ptr (Complex Double) --
395type TF = CInt -> PF -> IO CInt --
396type TFF = CInt -> PF -> TF --
397type TFV = CInt -> PF -> TV --
398type TVF = CInt -> PD -> TF --
399type TFFF = CInt -> PF -> TFF --
400type TV = CInt -> PD -> IO CInt --
401type TVV = CInt -> PD -> TV --
402type TVVV = CInt -> PD -> TVV --
403type TFM = CInt -> CInt -> PF -> IO CInt --
404type TFMFM = CInt -> CInt -> PF -> TFM --
405type TFMFMFM = CInt -> CInt -> PF -> TFMFM --
406type TM = CInt -> CInt -> PD -> IO CInt --
407type TMM = CInt -> CInt -> PD -> TM --
408type TVMM = CInt -> PD -> TMM --
409type TMVMM = CInt -> CInt -> PD -> TVMM --
410type TMMM = CInt -> CInt -> PD -> TMM --
411type TVM = CInt -> PD -> TM --
412type TVVM = CInt -> PD -> TVM --
413type TMV = CInt -> CInt -> PD -> TV --
414type TMMV = CInt -> CInt -> PD -> TMV --
415type TMVM = CInt -> CInt -> PD -> TVM --
416type TMMVM = CInt -> CInt -> PD -> TMVM --
417type TCM = CInt -> CInt -> PC -> IO CInt --
418type TCVCM = CInt -> PC -> TCM --
419type TCMCVCM = CInt -> CInt -> PC -> TCVCM --
420type TMCMCVCM = CInt -> CInt -> PD -> TCMCVCM --
421type TCMCMCVCM = CInt -> CInt -> PC -> TCMCVCM --
422type TCMCM = CInt -> CInt -> PC -> TCM --
423type TVCM = CInt -> PD -> TCM --
424type TCMVCM = CInt -> CInt -> PC -> TVCM --
425type TCMCMVCM = CInt -> CInt -> PC -> TCMVCM --
426type TCMCMCM = CInt -> CInt -> PC -> TCMCM --
427type TCV = CInt -> PC -> IO CInt --
428type TCVCV = CInt -> PC -> TCV --
429type TCVCVCV = CInt -> PC -> TCVCV --
430type TCVV = CInt -> PC -> TV --
431type TQV = CInt -> PQ -> IO CInt --
432type TQVQV = CInt -> PQ -> TQV --
433type TQVQVQV = CInt -> PQ -> TQVQV --
434type TQVF = CInt -> PQ -> TF --
435type TQM = CInt -> CInt -> PQ -> IO CInt --
436type TQMQM = CInt -> CInt -> PQ -> TQM --
437type TQMQMQM = CInt -> CInt -> PQ -> TQMQM --
438type TCMCV = CInt -> CInt -> PC -> TCV --
439type TVCV = CInt -> PD -> TCV --
440type TCVM = CInt -> PC -> TM --
441type TMCVM = CInt -> CInt -> PD -> TCVM --
442type TMMCVM = CInt -> CInt -> PD -> TMCVM --
443
diff --git a/packages/hmatrix/src/Numeric/IO.hs b/packages/hmatrix/src/Numeric/IO.hs
index 836f352..58fa2b4 100644
--- a/packages/hmatrix/src/Numeric/IO.hs
+++ b/packages/hmatrix/src/Numeric/IO.hs
@@ -20,11 +20,12 @@ module Numeric.IO (
20) where 20) where
21 21
22import Data.Packed 22import Data.Packed
23import Data.Packed.Internal 23import Data.Packed.Development
24import System.Process(readProcess) 24import System.Process(readProcess)
25import Text.Printf(printf) 25import Text.Printf(printf)
26import Data.List(intersperse) 26import Data.List(intersperse)
27import Data.Complex 27import Data.Complex
28import Numeric.GSL.Vector
28 29
29{- | Creates a string from a matrix given a separator and a function to show each entry. Using 30{- | Creates a string from a matrix given a separator and a function to show each entry. Using
30this function the user can easily define any desired display function: 31this function the user can easily define any desired display function:
diff --git a/packages/hmatrix/src/Numeric/LinearAlgebra/Algorithms.hs b/packages/hmatrix/src/Numeric/LinearAlgebra/Algorithms.hs
index 8c4b610..0a6eaa1 100644
--- a/packages/hmatrix/src/Numeric/LinearAlgebra/Algorithms.hs
+++ b/packages/hmatrix/src/Numeric/LinearAlgebra/Algorithms.hs
@@ -79,8 +79,8 @@ module Numeric.LinearAlgebra.Algorithms (
79) where 79) where
80 80
81 81
82import Data.Packed.Internal hiding ((//)) 82import Data.Packed.Development hiding ((//))
83import Data.Packed.Matrix 83import Data.Packed
84import Numeric.LinearAlgebra.LAPACK as LAPACK 84import Numeric.LinearAlgebra.LAPACK as LAPACK
85import Data.List(foldl1') 85import Data.List(foldl1')
86import Data.Array 86import Data.Array