diff --git a/CHANGES b/CHANGES
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,25 @@
+0.9.3.0
+=======
+
+- flag -fvector to optionally use Data.Vector.Storable.Vector
+  without any conversion.
+
+- Simpler module structure.
+
+- toBlocks, toBlocksEvery
+
+- cholSolve, mbCholSH
+
+- GSL Nonlinear Least-Squares fitting using Levenberg-Marquardt.
+
+- GSL special functions moved to separate package hmatrix-special.
+
+- Added offset of Vector, allowing fast, noncopy subVector (slice).
+  Vector is now identical to Roman Leshchinskiy's Data.Vector.Storable.Vector,
+  so we can convert from/to them in O(1).
+
+- Removed Data.Packed.Convert, see examples/vector.hs
+
 0.8.3.0
 =======
 
diff --git a/INSTALL b/INSTALL
--- a/INSTALL
+++ b/INSTALL
@@ -1,56 +1,36 @@
------------------------------------------
- A simple scientific library for Haskell
------------------------------------------
-
 INSTALLATION
 
-Recommended method (ok in Ubuntu/Debian systems):
+Recommended method (tested on Ubuntu/Debian systems):
     $ sudo apt-get install libgsl0-dev liblapack-dev
     $ cabal install hmatrix
 
 Detailed installation instructions:
-    http://www.hmatrix.googlepages.com/installation
-
-INSTALLATION ON WINDOWS ----------------------------------------
-
-1) Install a recent ghc (e.g. ghc-6.10.3)
-
-2) Install cabal-install. A binary for windows can be obtained from:
+    http://code.haskell.org/hmatrix/install.html
 
-   http://www.haskell.org/cabal/release/cabal-install-0.6.2/cabal.exe
+INSTALLATION ON WINDOWS
 
-   Put it somewhere in the path, for instance in c:\ghc\ghc-6.10.3\bin
+1) Install the Haskell Platform (tested on 2009.2.0.2).
 
-3) Download and uncompress in a temporary location the following file:
+2) Download and unzip the following file into a stable folder %GSL%
 
    http://code.haskell.org/hmatrix/gsl-lapack-windows.zip
 
-   It contains a folder, gsl, and four DLL's.
-
-4) Move the gsl folder to C:\ghc\ghc-6.10.3\include
-
-5) Move the four DLL's to C:\ghc\ghc-6.10.3\bin
-
-6) Download and uncompress hmatrix-x.y.z.tar.gz from Hackage:
-
-   http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix
-
-7) Edit hmatrix.cabal:
+3.a) In a msys shell installation should be fully automatic:
 
-     line 17:      build-type:         Custom
-     change to:    build-type:         Simple
+   $ cabal install hmatrix --extra-lib-dir=${GSL} --extra-include-dir=${GSL}
 
-     and at the end of the file add:
+3.b) Alternatively, in a normal windows cmd:
 
-        extra-libraries: libgsl-0 blas lapack
-        extra-lib-dirs: c:\ghc\ghc-6.10.3\bin
+    > cabal unpack hmatrix
 
-8) Open a terminal, cd to the hmatrix folder, and run
+    Edit hmatrix.cabal, in line 18 change build-type to "Simple", and then
 
-   > cabal install
+    > cabal install --extra-lib-dir=%GSL% --extra-include-dir=%GSL%
 
-9) If everything is ok we can run the tests:
+4) If everything is ok we can run the tests:
 
-   > runhaskell examples\tests.hs
+   > ghci
+   Prelude> Numeric.LinearAlgebra.Tests.runTests 20
 
 NOTE: The examples using graphics do not yet work in windows.
+
diff --git a/README b/README
deleted file mode 100644
--- a/README
+++ /dev/null
@@ -1,112 +0,0 @@
------------------------------------------
- A simple scientific library for Haskell
------------------------------------------
-
-INSTALLATION
-
-See the INSTALL file.
-
-TESTS ---------------------------------------------
-
-$ ghci
-Prelude> Numeric.LinearAlgebra.Tests.runTests 20
-
-EXAMPLES ------------------------------------------------------
-
-$ ghci
-Prelude> :m + Numeric.GSL
-Prelude Numeric.GSL> let quad = integrateQNG 1E-10
-Prelude Numeric.GSL> quad (^2) 0 1
-(0.3333333333333333,3.700743415417188e-15)
-
-Prelude Numeric.GSL> :m + Numeric.LinearAlgebra
-Prelude Numeric.LinearAlgebra> let m = (2><3)[1,2,3,4,5,6::Double]
-Prelude Numeric.LinearAlgebra> let (u,d,v) = full svd m
-Prelude Numeric.LinearAlgebra> d
-(2><3)
- [ 9.508032000695724,                0.0, 0.0
- ,               0.0, 0.7728696356734838, 0.0 ]
-Prelude Numeric.LinearAlgebra> u <> d <> trans v
-(2><3)
- [ 1.0000000000000004,               2.0, 3.0
- , 3.9999999999999996, 5.000000000000001, 6.0 ]
-Prelude Numeric.GSL> :q
-Leaving GHCi.
-
-A number of illustrative programs are included in the examples folder.
-
-KNOWN PROBLEMS / BUGS -------------------------------
-
-- On 64-bit machines the example "minimize.hs", when run from ghci,
-  produces a segmentation fault. It happens in the call to
-  gsl_multimin_fdfminimizer_alloc, inside the C wrapper.
-  If the program is called by runhaskell, it just terminates
-  prematurely, producing no results. Curiously, in compiled mode the
-  program seems to work perfectly well.
-
-- On Ubuntu 6.06 LTS (Dapper) atlas3-sse2-dev (3.6.0-20)
-  produced segmentation faults when working with big matrices
-  on compiled programs.
-
-ACKNOWLEDGEMENTS -----------------------------------------------------
-
-I thank Don Stewart, Henning Thielemann, Bulat Ziganshin, Heinrich Apfelmus,
-and all the people in the Haskell mailing lists for their help.
-
-- Nico Mahlo discovered a bug in the eigendecomposition wrapper.
-
-- Frederik Eaton discovered a bug in the design of the wrappers.
-
-- Eric Kidd has created a wiki page explaining the installation on MacOS X:
-  http://www.haskell.org/haskellwiki/GSLHaskell_on_MacOS_X
-
-- Fawzi Mohamed discovered a portability bug in the lapack wrappers.
-
-- Pedro E. López de Teruel fixed the interface to lapack.
-
-- Antti Siira discovered a bug in the plotting functions.
-
-- Paulo Tanimoto helped to fix the configuration of the required libraries.
-  He also discovered the segfault of minimize.hs in ghci.
-
-- Xiao-Yong Jin reported a bug on x86_64 caused by the assumptions in f2c.h,
-  which are wrong for this architecture.
-
-- Jason Schroeder reported an error in the documentation.
-
-- Bulat Ziganshin gave invaluable help for the ST monad interface to
-  in-place modifications.
-
-- Don Stewart fixed the implementation of the internal data structures
-  to achieve excellent, C-like performance in Haskell functions which
-  explicitly work with the elements of vectors and matrices.
-
-- Dylan Alex Simon improved the numeric instances to allow optimized
-  implementations of signum and abs on Vectors.
-
-- Pedro E. López de Teruel discovered the need of asm("finit") to
-  avoid the wrong NaNs produced by foreign functions.
-
-- Reiner Pope added support for luSolve, based on (d|z)getrs.
-
-- Simon Beaumont reported the need of QuickCheck<2 and the invalid
-  asm("finit") on ppc. He also contributed the configuration options
-  for the accelerate framework on OS X.
-
-- Daniel Schüssler added compatibility with QuickCheck 2 as well
-  as QuickCheck 1 using the C preprocessor. He also added some
-  implementations for the new "shrink" method of class Arbitrary.
-
-- Tracy Wadleigh improved the definitions of (|>) and (><), which now
-  apply an appropriate 'take' to the given lists so that they may be
-  safely used on lists that are too long (or infinite).
-
-- Chris Waterson improved the configure.hs program for OS/X.
-
-- Erik de Castro Lopo added buildVector and buildMatrix, which take a
-  size parameter(s) and a function that maps vector/matrix indices
-  to the values at that position.
-
-- Jean-Francois Tremblay discovered an error in the tutorial.
-
-- Heinrich Apfelmus fixed hmatrix.cabal for OS/X.
diff --git a/THANKS b/THANKS
new file mode 100644
--- /dev/null
+++ b/THANKS
@@ -0,0 +1,74 @@
+I thank Don Stewart, Henning Thielemann, Bulat Ziganshin, Heinrich Apfelmus,
+and all the people in the Haskell mailing lists for their help.
+
+- Nico Mahlo discovered a bug in the eigendecomposition wrapper.
+
+- Frederik Eaton discovered a bug in the design of the wrappers.
+
+- Eric Kidd has created a wiki page explaining the installation on MacOS X:
+  http://www.haskell.org/haskellwiki/GSLHaskell_on_MacOS_X
+
+- Fawzi Mohamed discovered a portability bug in the lapack wrappers.
+
+- Pedro E. López de Teruel fixed the interface to lapack.
+
+- Antti Siira discovered a bug in the plotting functions.
+
+- Paulo Tanimoto helped to fix the configuration of the required libraries.
+  He also discovered the segfault of minimize.hs in ghci.
+
+- Xiao-Yong Jin reported a bug on x86_64 caused by the assumptions in f2c.h,
+  which are wrong for this architecture.
+
+- Jason Schroeder reported an error in the documentation.
+
+- Bulat Ziganshin gave invaluable help for the ST monad interface to
+  in-place modifications.
+
+- Don Stewart fixed the implementation of the internal data structures
+  to achieve excellent, C-like performance in Haskell functions which
+  explicitly work with the elements of vectors and matrices.
+
+- Dylan Alex Simon improved the numeric instances to allow optimized
+  implementations of signum and abs on Vectors.
+
+- Pedro E. López de Teruel discovered the need of asm("finit") to
+  avoid the wrong NaNs produced by foreign functions.
+
+- Reiner Pope added support for luSolve, based on (d|z)getrs.
+
+- Simon Beaumont reported the need of QuickCheck<2 and the invalid
+  asm("finit") on ppc. He also contributed the configuration options
+  for the accelerate framework on OS X.
+
+- Daniel Schüssler added compatibility with QuickCheck 2 as well
+  as QuickCheck 1 using the C preprocessor. He also added some
+  implementations for the new "shrink" method of class Arbitrary.
+
+- Tracy Wadleigh improved the definitions of (|>) and (><), which now
+  apply an appropriate 'take' to the given lists so that they may be
+  safely used on lists that are too long (or infinite).
+
+- Chris Waterson improved the configure.hs program for OS/X.
+
+- Erik de Castro Lopo added buildVector and buildMatrix, which take a
+  size parameter(s) and a function that maps vector/matrix indices
+  to the values at that position.
+
+- Jean-Francois Tremblay discovered an error in the tutorial.
+
+- Gilberto Camara contributed improved blas and lapack dlls for Windows.
+
+- Heinrich Apfelmus fixed hmatrix.cabal for OS/X. He also tested the package
+  on PPC discovering a problem in zgesdd.
+
+- Felipe Lessa tested the performance of GSL special function bindings
+  and contributed the cabal flag "safe-cheap".
+
+- Ozgur Akgun suggested better symbols for the Bound constructors in the
+  Linear Programming package.
+
+- Tim Sears reported the zgesdd problem also in intel mac.
+
+- Max Suica simplified the installation on Windows and improved the instructions.
+
diff --git a/examples/devel/ej1/functions.c b/examples/devel/ej1/functions.c
new file mode 100644
--- /dev/null
+++ b/examples/devel/ej1/functions.c
@@ -0,0 +1,35 @@
+/* assuming row order */
+
+typedef struct { double r, i; } doublecomplex;
+
+#define DVEC(A) int A##n, double*A##p
+#define CVEC(A) int A##n, doublecomplex*A##p
+#define DMAT(A) int A##r, int A##c, double*A##p
+#define CMAT(A) int A##r, int A##c, doublecomplex*A##p
+
+#define AT(M,row,col) (M##p[(row)*M##c + (col)])
+
+/*-----------------------------------------------------*/
+
+int c_scale_vector(double s, DVEC(x), DVEC(y)) {
+    int k;
+    for (k=0; k<=yn; k++) {
+        yp[k] = s*xp[k];
+    }
+    return 0;
+}
+
+/*-----------------------------------------------------*/
+
+int c_diag(DMAT(m),DVEC(y),DMAT(z)) {
+    int i,j;
+    for (j=0; j<yn; j++) {
+        yp[j] = AT(m,j,j);
+    }
+    for (i=0; i<mr; i++) {
+        for (j=0; j<mc; j++) {
+            AT(z,i,j) = i==j?yp[i]:0;
+        }
+    }
+    return 0;
+}
diff --git a/examples/devel/ej1/wrappers.hs b/examples/devel/ej1/wrappers.hs
new file mode 100644
--- /dev/null
+++ b/examples/devel/ej1/wrappers.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- $ ghc -O2 --make wrappers.hs functions.c
+
+import Numeric.LinearAlgebra
+import Data.Packed.Development
+import Foreign(Ptr,unsafePerformIO)
+import Foreign.C.Types(CInt)
+
+-----------------------------------------------------
+
+main = do
+    print $ myScale 3.0 (fromList [1..10])
+    print $ myDiag $ (3><5) [1..]
+
+-----------------------------------------------------
+
+foreign import ccall "c_scale_vector"
+    cScaleVector :: Double                -- scale
+                 -> CInt -> Ptr Double    -- argument
+                 -> CInt -> Ptr Double    -- result
+                 -> IO CInt               -- exit code
+
+myScale s x = unsafePerformIO $ do
+    y <- createVector (dim x)
+    app2 (cScaleVector s) vec x vec y "cScaleVector"
+    return y
+
+-----------------------------------------------------
+-- forcing row order
+
+foreign import ccall "c_diag"
+    cDiag :: CInt -> CInt -> Ptr Double  -- argument
+          -> CInt -> Ptr Double          -- result1
+          -> CInt -> CInt -> Ptr Double  -- result2
+          -> IO CInt                     -- exit code
+
+myDiag m = unsafePerformIO $ do
+    y <- createVector (min r c)
+    z <- createMatrix RowMajor r c
+    app3 cDiag mat (cmat m) vec y mat z "cDiag"
+    return (y,z)
+  where r = rows m
+        c = cols m
diff --git a/examples/devel/ej2/functions.c b/examples/devel/ej2/functions.c
new file mode 100644
--- /dev/null
+++ b/examples/devel/ej2/functions.c
@@ -0,0 +1,24 @@
+/*  general element order   */
+
+typedef struct { double r, i; } doublecomplex;
+
+#define DVEC(A) int A##n, double*A##p
+#define CVEC(A) int A##n, doublecomplex*A##p
+#define DMAT(A) int A##r, int A##c, double*A##p
+#define CMAT(A) int A##r, int A##c, doublecomplex*A##p
+
+#define AT(M,r,c) (M##p[(r)*sr+(c)*sc])
+
+int c_diag(int ro, DMAT(m),DVEC(y),DMAT(z)) {
+    int i,j,sr,sc;
+    if (ro==1) { sr = mc; sc = 1;} else { sr = 1; sc = mr;}
+    for (j=0; j<yn; j++) {
+        yp[j] = AT(m,j,j);
+    }
+    for (i=0; i<mr; i++) {
+        for (j=0; j<mc; j++) {
+            AT(z,i,j) = i==j?yp[i]:0;
+        }
+    }
+    return 0;
+}
diff --git a/examples/devel/ej2/wrappers.hs b/examples/devel/ej2/wrappers.hs
new file mode 100644
--- /dev/null
+++ b/examples/devel/ej2/wrappers.hs
@@ -0,0 +1,32 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+-- $ ghc -O2 --make wrappers.hs functions.c
+
+import Numeric.LinearAlgebra
+import Data.Packed.Development
+import Foreign(Ptr,unsafePerformIO)
+import Foreign.C.Types(CInt)
+
+-----------------------------------------------------
+
+main = do
+    print $ myDiag $ (3><5) [1..]
+
+-----------------------------------------------------
+-- arbitrary data order
+
+foreign import ccall "c_diag"
+    cDiag :: CInt                        -- matrix order
+          -> CInt -> CInt -> Ptr Double  -- argument
+          -> CInt -> Ptr Double          -- result1
+          -> CInt -> CInt -> Ptr Double  -- result2
+          -> IO CInt                     -- exit code
+
+myDiag m = unsafePerformIO $ do
+    y <- createVector (min r c)
+    z <- createMatrix (orderOf m) r c
+    app3 (cDiag o) mat m vec y mat z "cDiag"
+    return (y,z)
+  where r = rows m
+        c = cols m
+        o = if orderOf m == RowMajor then 1 else 0
diff --git a/examples/devel/functions.c b/examples/devel/functions.c
deleted file mode 100644
--- a/examples/devel/functions.c
+++ /dev/null
@@ -1,34 +0,0 @@
-typedef struct { double r, i; } doublecomplex;
-
-#define DVEC(A) int A##n, double*A##p
-#define CVEC(A) int A##n, doublecomplex*A##p
-#define DMAT(A) int A##r, int A##c, double*A##p
-#define CMAT(A) int A##r, int A##c, doublecomplex*A##p
-
-#define AT(M,r,c) (M##p[(r)*sr+(c)*sc])
-
-/*-----------------------------------------------------*/
-
-int c_scale_vector(double s, DVEC(x), DVEC(y)) {
-    int k;
-    for (k=0; k<=yn; k++) {
-        yp[k] = s*xp[k];
-    }
-    return 0;
-}
-
-/*-----------------------------------------------------*/
-
-int c_diag(int ro, DMAT(m),DVEC(y),DMAT(z)) {
-    int i,j,sr,sc;
-    if (ro==1) { sr = mc; sc = 1;} else { sr = 1; sc = mr;}
-    for (j=0; j<yn; j++) {
-        yp[j] = AT(m,j,j);
-    }
-    for (i=0; i<mr; i++) {
-        for (j=0; j<mc; j++) {
-            AT(z,i,j) = i==j?yp[i]:0;
-        }
-    }
-    return 0;
-}
diff --git a/examples/devel/wrappers.hs b/examples/devel/wrappers.hs
deleted file mode 100644
--- a/examples/devel/wrappers.hs
+++ /dev/null
@@ -1,45 +0,0 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
-
--- $ ghc -O2 --make wrappers.hs functions.c
-
-import Numeric.LinearAlgebra
-import Data.Packed.Development
-import Foreign(Ptr,unsafePerformIO)
-import Foreign.C.Types(CInt)
-
------------------------------------------------------
-
-main = do
-    print $ myScale 3.0 (fromList [1..10])
-    print $ myDiag $ (3><5) [1..]
-
------------------------------------------------------
-
-foreign import ccall "c_scale_vector"
-    cScaleVector :: Double                -- scale
-                 -> CInt -> Ptr Double    -- argument
-                 -> CInt -> Ptr Double    -- result
-                 -> IO CInt               -- exit code
-
-myScale s x = unsafePerformIO $ do
-    y <- createVector (dim x)
-    app2 (cScaleVector s) vec x vec y "cScaleVector"
-    return y
-
------------------------------------------------------
-
-foreign import ccall "c_diag"
-    cDiag :: CInt                        -- matrix order
-          -> CInt -> CInt -> Ptr Double  -- argument
-          -> CInt -> Ptr Double          -- result1
-          -> CInt -> CInt -> Ptr Double  -- result2
-          -> IO CInt                     -- exit code
-
-myDiag m = unsafePerformIO $ do
-    y <- createVector (min r c)
-    z <- createMatrix (orderOf m) r c
-    app3 (cDiag o) mat m vec y mat z "cDiag"
-    return (y,z)
-  where r = rows m
-        c = cols m
-        o = if orderOf m == RowMajor then 1 else 0
diff --git a/examples/error.hs b/examples/error.hs
--- a/examples/error.hs
+++ b/examples/error.hs
@@ -1,4 +1,5 @@
 import Numeric.GSL
+import Numeric.GSL.Special
 import Numeric.LinearAlgebra
 import Prelude hiding (catch)
 import Control.Exception
diff --git a/examples/parallel.hs b/examples/parallel.hs
--- a/examples/parallel.hs
+++ b/examples/parallel.hs
@@ -6,19 +6,16 @@
 import System.Time
 
 inParallel = parMap rwhnf id
---  rdeepseq (or older rnf) not needed in this case
 
+
 -- matrix product decomposed into p parallel subtasks
 parMul p x y = fromBlocks [ inParallel ( map (x <>) ys ) ]
-    where ys = splitColumns p y
-
--- x <||> y = fromColumns . inParallel . map (x <>) . toColumns $ y
+    where [ys] = toBlocksEvery (rows y) (cols y `div` p) y
 
 main = do
     n <- (read . head) `fmap` getArgs
     let m = ident n :: Matrix Double
     time $ print $ vectorMax $ takeDiag $ m <> m
---    time $ print $ vectorMax $ takeDiag $ m <||> m
     time $ print $ vectorMax $ takeDiag $ parMul 2 m m
     time $ print $ vectorMax $ takeDiag $ parMul 4 m m
     time $ print $ vectorMax $ takeDiag $ parMul 8 m m
@@ -28,15 +25,3 @@
     act
     t1 <- getClockTime
     print $ tdSec $ normalizeTimeDiff $ diffClockTimes t1 t0
-
-splitColumns n m = splitColumns' (f n (cols m)) m
-    where
-    splitColumns' [] m = []
-    splitColumns' ((a,b):rest) m = subMatrix (0,a) (rows m, b-a+1) m : splitColumns' rest m
-
-    f :: Int -> Int -> [(Int,Int)]
-    f n c = zip ks (map pred $ tail ks)
-        where ks = map round $ toList $ linspace (fromIntegral n+1) (0,fromIntegral c)
-
-splitRowsAt p m    = (takeRows p m, dropRows p m)
-splitColumnsAt p m = (takeColumns p m, dropColumns p m)
diff --git a/examples/plot.hs b/examples/plot.hs
--- a/examples/plot.hs
+++ b/examples/plot.hs
@@ -1,6 +1,6 @@
 import Numeric.LinearAlgebra
 import Graphics.Plot
-import Numeric.GSL(erf_Z, erf)
+import Numeric.GSL.Special(erf_Z, erf)
 
 sombrero n = f x y where 
     (x,y) = meshdom range range
diff --git a/examples/vector.hs b/examples/vector.hs
new file mode 100644
--- /dev/null
+++ b/examples/vector.hs
@@ -0,0 +1,32 @@
+-- conversion to/from Data.Vector.Storable
+-- from Roman Leshchinskiy "vector" package
+--
+-- In the future Data.Packed.Vector will be replaced by Data.Vector.Storable
+
+-------------------------------------------
+
+import Numeric.LinearAlgebra as H
+import Data.Packed.Development(unsafeFromForeignPtr, unsafeToForeignPtr)
+import Foreign.Storable
+import qualified Data.Vector.Storable as V
+
+fromVector :: Storable t => V.Vector t -> H.Vector t
+fromVector v = unsafeFromForeignPtr p i n where
+    (p,i,n) = V.unsafeToForeignPtr v
+
+toVector :: H.Vector t -> V.Vector t
+toVector v = V.unsafeFromForeignPtr p i n where
+    (p,i,n) = unsafeToForeignPtr v
+
+-------------------------------------------
+
+v = V.slice 5 10 (V.fromList [1 .. 10::Double] V.++ V.replicate 10 7)
+
+w = subVector 2 3 (linspace 10 (0,2))
+
+main = do
+    print v
+    print $ fromVector v
+    print w
+    print $ toVector w
+
diff --git a/hmatrix.cabal b/hmatrix.cabal
--- a/hmatrix.cabal
+++ b/hmatrix.cabal
@@ -1,5 +1,5 @@
 Name:               hmatrix
-Version:            0.8.3.1
+Version:            0.9.3.0
 License:            GPL
 License-file:       LICENSE
 Author:             Alberto Ruiz
@@ -10,6 +10,8 @@
 Description:        Purely functional interface to basic linear algebra
                     and other numerical computations, internally implemented using
                     GSL, BLAS and LAPACK.
+                    .
+                    See also hmatrix-special and hmatrix-glpk.
 Category:           Math
 tested-with:        GHC ==6.10.4, GHC ==6.12.1
 
@@ -18,7 +20,7 @@
 build-type:         Custom
 
 extra-source-files: lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h
-                    configure configure.hs README INSTALL CHANGES
+                    configure configure.hs THANKS INSTALL CHANGES
 extra-tmp-files:    hmatrix.buildinfo
 
 extra-source-files: examples/tests.hs
@@ -37,17 +39,24 @@
                     examples/plot.hs
                     examples/inplace.hs
                     examples/error.hs
-                    examples/devel/wrappers.hs
-                    examples/devel/functions.c
+                    examples/devel/ej1/wrappers.hs
+                    examples/devel/ej1/functions.c
+                    examples/devel/ej2/wrappers.hs
+                    examples/devel/ej2/functions.c
                     examples/Real.hs
+                    examples/vector.hs
 
 extra-source-files: lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h,
                     lib/Numeric/LinearAlgebra/LAPACK/clapack.h
 
-extra-source-files: lib/Numeric/GSL/Special/auto.hs,
-                    lib/Numeric/GSL/Special/autoall.sh,
-                    lib/Numeric/GSL/Special/replace.hs
+flag tests
+    description:    Build tests
+    default:        True
 
+flag dd
+    description:    svd = zgesdd
+    default:        True
+
 flag mkl
     description:    Link with Intel's MKL optimized libraries.
     default:        False
@@ -56,12 +65,14 @@
     description:    Compile the library with bound checking disabled.
     default:        False
 
+flag vector
+    description:    Use Data.Vector.Storable type from "vector" package.
+    default:        False
+
 library
 
-    Build-Depends:      base >= 3 && < 5,
+    Build-Depends:      base >= 4 && < 5,
                         array,
-                        haskell98,
-                        QuickCheck, HUnit,
                         storable-complex,
                         process
 
@@ -78,47 +89,16 @@
                         Numeric.GSL.Polynomials,
                         Numeric.GSL.Minimization,
                         Numeric.GSL.Root,
+                        Numeric.GSL.Fitting,
                         Numeric.GSL.ODE,
                         Numeric.GSL.Vector,
-                        Numeric.GSL.Special,
-                        Numeric.GSL.Special.Gamma,
-                        Numeric.GSL.Special.Erf,
-                        Numeric.GSL.Special.Airy,
-                        Numeric.GSL.Special.Exp,
-                        Numeric.GSL.Special.Bessel,
-                        Numeric.GSL.Special.Clausen,
-                        Numeric.GSL.Special.Coulomb,
-                        Numeric.GSL.Special.Coupling,
-                        Numeric.GSL.Special.Dawson,
-                        Numeric.GSL.Special.Debye,
-                        Numeric.GSL.Special.Dilog,
-                        Numeric.GSL.Special.Elementary,
-                        Numeric.GSL.Special.Ellint,
-                        Numeric.GSL.Special.Elljac,
-                        Numeric.GSL.Special.Expint,
-                        Numeric.GSL.Special.Fermi_dirac,
-                        Numeric.GSL.Special.Gegenbauer,
-                        Numeric.GSL.Special.Hyperg,
-                        Numeric.GSL.Special.Laguerre,
-                        Numeric.GSL.Special.Lambert,
-                        Numeric.GSL.Special.Legendre,
-                        Numeric.GSL.Special.Log,
-                        Numeric.GSL.Special.Pow_int,
-                        Numeric.GSL.Special.Psi,
-                        Numeric.GSL.Special.Synchrotron,
-                        Numeric.GSL.Special.Transport,
-                        Numeric.GSL.Special.Trig,
-                        Numeric.GSL.Special.Zeta,
                         Numeric.GSL,
                         Numeric.LinearAlgebra,
                         Numeric.LinearAlgebra.LAPACK,
-                        Numeric.LinearAlgebra.Linear,
-                        Numeric.LinearAlgebra.Instances,
                         Numeric.LinearAlgebra.Interface,
                         Numeric.LinearAlgebra.Algorithms,
                         Graphics.Plot,
-                        Numeric.LinearAlgebra.Tests,
-                        Data.Packed.Convert,
+                     -- Data.Packed.Convert,
                         Data.Packed.ST,
                         Data.Packed.Development,
                         Data.Packed.Random
@@ -127,15 +107,25 @@
                         Data.Packed.Internal.Signatures,
                         Data.Packed.Internal.Vector,
                         Data.Packed.Internal.Matrix,
-                        Numeric.GSL.Internal,
-                        Numeric.GSL.Special.Internal,
-                        Numeric.LinearAlgebra.Tests.Instances,
-                        Numeric.LinearAlgebra.Tests.Properties
+                        Numeric.LinearAlgebra.Linear,
+                        Numeric.LinearAlgebra.Instances,
+                        Numeric.GSL.Internal
+
     C-sources:          lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c,
                         lib/Numeric/GSL/gsl-aux.c
 
-    ghc-prof-options:   -auto
+    if flag(vector)
+       Build-Depends:   vector
+       cpp-options:     -DVECTOR
 
+    if flag(tests)
+       Build-Depends:   QuickCheck, HUnit
+       exposed-modules: Numeric.LinearAlgebra.Tests
+       other-modules:   Numeric.LinearAlgebra.Tests.Instances,
+                        Numeric.LinearAlgebra.Tests.Properties
+
+ -- ghc-prof-options:   -auto
+
     ghc-options:        -Wall -fno-warn-missing-signatures
                               -fno-warn-orphans
                               -fno-warn-unused-binds
@@ -143,6 +133,9 @@
     if flag(unsafe)
         cpp-options: -DUNSAFE
 
+    if !flag(dd)
+        cpp-options: -DNOZGESDD
+
     if impl(ghc < 6.10.2)
         cpp-options: -DFINIT
 
@@ -157,6 +150,9 @@
         include-dirs: /opt/local/include
         extra-libraries: gsl
         frameworks: Accelerate
+
+    if os(windows)
+        extra-libraries: gsl-0 blas lapack
 
 -- The extra-libraries required for GSL and LAPACK
 -- should now be automatically detected by configure(.hs)
diff --git a/lib/Data/Packed.hs b/lib/Data/Packed.hs
--- a/lib/Data/Packed.hs
+++ b/lib/Data/Packed.hs
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
 -----------------------------------------------------------------------------
 {- |
 Module      :  Data.Packed
@@ -17,59 +16,12 @@
 module Data.Packed (
     module Data.Packed.Vector,
     module Data.Packed.Matrix,
-    module Data.Complex,
-    Container(..)
+    module Data.Packed.Random,
+    module Data.Complex
 ) where
 
 import Data.Packed.Vector
 import Data.Packed.Matrix
+import Data.Packed.Random
 import Data.Complex
-import Data.Packed.Internal(fromComplex,toComplex,conj)
 
--- | conversion utilities
-class (Element e) => Container c e where
-    toComplex   :: RealFloat e => (c e, c e) -> c (Complex e)
-    fromComplex :: RealFloat e => c (Complex e) -> (c e, c e)
-    comp        :: RealFloat e => c e -> c (Complex e)
-    conj        :: RealFloat e => c (Complex e) -> c (Complex e)
-    real        :: c Double -> c e
-    complex     :: c e -> c (Complex Double)
-
-instance Container Vector Double where
-    toComplex = Data.Packed.Internal.toComplex
-    fromComplex = Data.Packed.Internal.fromComplex
-    comp = internalcomp
-    conj = Data.Packed.Internal.conj
-    real = id
-    complex = Data.Packed.comp
-
-instance Container Vector (Complex Double) where
-    toComplex = undefined -- can't match
-    fromComplex = undefined
-    comp = undefined
-    conj = undefined
-    real = Data.Packed.comp
-    complex = id
-
-instance Container Matrix Double where
-    toComplex = uncurry $ liftMatrix2 $ curry Data.Packed.toComplex
-    fromComplex z = (reshape c r, reshape c i)
-        where (r,i) = Data.Packed.fromComplex (flatten z)
-              c = cols z
-    comp = liftMatrix internalcomp
-    conj = liftMatrix Data.Packed.Internal.conj
-    real = id
-    complex = Data.Packed.comp
-
-instance Container Matrix (Complex Double) where
-    toComplex = undefined
-    fromComplex = undefined
-    comp = undefined
-    conj = undefined
-    real = Data.Packed.comp
-    complex = id
-
-
--- | converts a real vector into a complex representation (with zero imaginary parts)
-internalcomp :: Vector Double -> Vector (Complex Double)
-internalcomp v = Data.Packed.Internal.toComplex (v,constant 0 (dim v))
diff --git a/lib/Data/Packed/Convert.hs b/lib/Data/Packed/Convert.hs
deleted file mode 100644
--- a/lib/Data/Packed/Convert.hs
+++ /dev/null
@@ -1,101 +0,0 @@
-{-# OPTIONS -XTypeOperators -XRank2Types  -XFlexibleContexts #-}
-
------------------------------------------------------------------------------
--- |
--- Module      :  Data.Packed.Convert
--- Copyright   :  (c) Alberto Ruiz 2008
--- License     :  GPL-style
---
--- Maintainer  :  Alberto Ruiz <aruiz@um.es>
--- Stability   :  provisional
--- Portability :  portable
---
--- Conversion of Vectors and Matrices to and from the standard Haskell arrays.
--- (provisional)
---
------------------------------------------------------------------------------
-
-module Data.Packed.Convert (
-    arrayFromVector, vectorFromArray,
-    mArrayFromVector, vectorFromMArray,
-    vectorToStorableArray, storableArrayToVector,
-    arrayFromMatrix, matrixFromArray,
-    mArrayFromMatrix, matrixFromMArray,
---    matrixToStorableArray, storableArrayToMatrix
-) where
-
-import Data.Packed.Internal
-import Data.Array.Storable
-import Foreign
-import Control.Monad.ST
-import Data.Array.ST
-import Data.Array.Unboxed
-
--- | Creates a StorableArray indexed from 0 to dim -1.
---   (Memory is efficiently copied, so you can then freely modify the obtained array)
-vectorToStorableArray :: Storable t => Vector t -> IO (StorableArray Int t)
-vectorToStorableArray v = do
-    r <- cloneVector v
-    unsafeForeignPtrToStorableArray (fptr r) (0,dim r -1)
-
--- | Creates a Vector from a StorableArray.
---   (Memory is efficiently copied, so posterior changes in the array will not affect the result)
-storableArrayToVector :: Storable t => StorableArray Int t -> IO (Vector t)
-storableArrayToVector s = do
-    (a,b) <- getBounds s
-    let n = (b-a+1)
-    r <- createVector n
-    withStorableArray s $ \p -> do
-        let f _ d =  copyArray d p n >> return 0
-        app1 f vec r "storableArrayToVector"
-    return r
-
-
-unsafeVectorToStorableArray :: Storable t => Vector t -> IO (StorableArray Int t)
-unsafeVectorToStorableArray v = unsafeForeignPtrToStorableArray (fptr v) (0,dim v -1)
-
---unsafeStorableArrayToVector :: Storable t => StorableArray Int t -> IO (Vector t)
---unsafeStorableArrayToVector s = undefined -- the foreign ptr of Storable Array is not available?
-
------------------------------------------------------------------
--- provisional, we need Unboxed arrays for Complex Double
-
-
-unsafeFreeze' :: (MArray a e m, Ix i) => a i e -> m (Array i e)
-unsafeFreeze' = unsafeFreeze
-
--- | creates an immutable Array from an hmatrix Vector (to do: unboxed)
-arrayFromVector :: (Storable t) => Vector t -> Array Int t
-arrayFromVector x = runSTArray (mArrayFromVector x)
-
--- | creates a mutable array from an hmatrix Vector (to do: unboxed)
-mArrayFromVector :: (MArray b t (ST s), Storable t) => Vector t -> ST s (b Int t)
-mArrayFromVector v = unsafeThaw =<< unsafeIOToST ( unsafeFreeze' =<< (vectorToStorableArray $ v))
-
-
--- (creates an hmatrix Vector from an immutable array (to do: unboxed))
-vectorFromArray :: (Storable t) => Array Int t -> Vector t
-vectorFromArray a = unsafePerformIO $ storableArrayToVector =<< unsafeThaw a
-
--- | creates a mutable Array from an hmatrix Vector for manipulation with runSTUArray (to do: unboxed)
-vectorFromMArray :: (Storable t, MArray a t (ST s)) => a Int t -> ST s (Vector t)
-vectorFromMArray x = fmap vectorFromArray (unsafeFreeze' x)
-
---------------------------------------------------------------------
--- provisional
-
-matrixFromArray :: UArray (Int, Int) Double -> Matrix Double
-matrixFromArray m = reshape c . fromList . elems $ m
-    where ((r1,c1),(r2,c2)) = bounds m
-          _r = r2-r1+1
-          c = c2-c1+1
-
-arrayFromMatrix :: Matrix Double -> UArray (Int, Int) Double
-arrayFromMatrix m = listArray ((0,0),(rows m -1, cols m -1)) (toList $ flatten m)
-
-
-mArrayFromMatrix :: (MArray b Double m) => Matrix Double -> m (b (Int, Int) Double)
-mArrayFromMatrix = unsafeThaw . arrayFromMatrix
-
-matrixFromMArray :: (MArray a Double (ST s)) => a (Int,Int) Double -> ST s (Matrix Double)
-matrixFromMArray x = fmap matrixFromArray (unsafeFreeze x)
diff --git a/lib/Data/Packed/Development.hs b/lib/Data/Packed/Development.hs
--- a/lib/Data/Packed/Development.hs
+++ b/lib/Data/Packed/Development.hs
@@ -9,8 +9,7 @@
 -- Stability   :  provisional
 -- Portability :  portable
 --
--- The implementation of the 'Vector' and 'Matrix' types is not exposed,
--- but the library can be easily extended with additional foreign functions
+-- The library can be easily extended with additional foreign functions
 -- using the tools in this module. Illustrative usage examples can be found
 -- in the @examples\/devel@ folder included in the package.
 --
@@ -21,7 +20,11 @@
     Adapt,
     vec, mat,
     app1, app2, app3, app4,
+    app5, app6, app7, app8, app9, app10,
     MatrixOrder(..), orderOf, cmat, fmat,
+    unsafeFromForeignPtr,
+    unsafeToForeignPtr,
+    check, (//)
 ) where
 
 import Data.Packed.Internal
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -17,7 +17,8 @@
 module Data.Packed.Internal.Common(
   Adapt,
   app1, app2, app3, app4,
-  (//), check,
+  app5, app6, app7, app8, app9, app10,
+  (//), check, mbCatch,
   splitEvery, common, compatdim,
   fi,
   table
@@ -29,6 +30,7 @@
 import Foreign.C.Types
 import Foreign.Storable.Complex()
 import Data.List(transpose,intersperse)
+import Control.Exception as E
 
 -- | @splitEvery 3 [1..9] == [[1,2,3],[4,5,6],[7,8,9]]@
 splitEvery :: Int -> [a] -> [[a]]
@@ -68,9 +70,15 @@
 fi = fromIntegral
 
 -- hmm..
-ww2 w1 o1 w2 o2 f = w1 o1 $ \a1 -> w2 o2 $ \a2 -> f a1 a2
-ww3 w1 o1 w2 o2 w3 o3 f = w1 o1 $ \a1 -> ww2 w2 o2 w3 o3 (f a1)
-ww4 w1 o1 w2 o2 w3 o3 w4 o4 f = w1 o1 $ \a1 -> ww3 w2 o2 w3 o3 w4 o4 (f a1)
+ww2 w1 o1 w2 o2 f = w1 o1 $ w2 o2 . f
+ww3 w1 o1 w2 o2 w3 o3 f = w1 o1 $ ww2 w2 o2 w3 o3 . f
+ww4 w1 o1 w2 o2 w3 o3 w4 o4 f = w1 o1 $ ww3 w2 o2 w3 o3 w4 o4 . f
+ww5 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 f = w1 o1 $ ww4 w2 o2 w3 o3 w4 o4 w5 o5 . f
+ww6 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 f = w1 o1 $ ww5 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 . f
+ww7 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 f = w1 o1 $ ww6 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 . f
+ww8 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 f = w1 o1 $ ww7 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 . f
+ww9 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 f = w1 o1 $ ww8 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 . f
+ww10 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 w10 o10 f = w1 o1 $ ww9 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 w10 o10 . f
 
 type Adapt f t r = t -> ((f -> r) -> IO()) -> IO()
 
@@ -114,9 +122,23 @@
 app2 f w1 o1 w2 o2 s = ww2 w1 o1 w2 o2 $ \a1 a2 -> f // a1 // a2 // check s
 app3 f w1 o1 w2 o2 w3 o3 s = ww3 w1 o1 w2 o2 w3 o3 $
      \a1 a2 a3 -> f // a1 // a2 // a3 // check s
-app4 f w1 o1 w2 o2 w3 o3 w4 o4 s = ww4 w1 o1 w2 o2 w3 o3 w4 o4 $ 
+app4 f w1 o1 w2 o2 w3 o3 w4 o4 s = ww4 w1 o1 w2 o2 w3 o3 w4 o4 $
      \a1 a2 a3 a4 -> f // a1 // a2 // a3 // a4 // check s
+app5 f w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 s = ww5 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 $
+     \a1 a2 a3 a4 a5 -> f // a1 // a2 // a3 // a4 // a5 // check s
+app6 f w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 s = ww6 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 $
+     \a1 a2 a3 a4 a5 a6 -> f // a1 // a2 // a3 // a4 // a5 // a6 // check s
+app7 f w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 s = ww7 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 $
+     \a1 a2 a3 a4 a5 a6 a7 -> f // a1 // a2 // a3 // a4 // a5 // a6 // a7 // check s
+app8 f w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 s = ww8 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 $
+     \a1 a2 a3 a4 a5 a6 a7 a8 -> f // a1 // a2 // a3 // a4 // a5 // a6 // a7 // a8 // check s
+app9 f w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 s = ww9 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 $
+     \a1 a2 a3 a4 a5 a6 a7 a8 a9 -> f // a1 // a2 // a3 // a4 // a5 // a6 // a7 // a8 // a9 // check s
+app10 f w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 w10 o10 s = ww10 w1 o1 w2 o2 w3 o3 w4 o4 w5 o5 w6 o6 w7 o7 w8 o8 w9 o9 w10 o10 $
+     \a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 -> f // a1 // a2 // a3 // a4 // a5 // a6 // a7 // a8 // a9 // a10 // check s
 
+
+
 -- GSL error codes are <= 1024
 -- | error codes for the auxiliary functions required by the wrappers
 errorCode :: CInt -> String
@@ -150,4 +172,10 @@
     return ()
 
 -- | description of GSL error codes
-foreign import ccall "auxi.h gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar)
+foreign import ccall "gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar)
+
+-- | Error capture and conversion to Maybe
+mbCatch :: IO x -> IO (Maybe x)
+mbCatch act = E.catch (Just `fmap` act) f
+    where f :: SomeException -> IO (Maybe x)
+          f _ = return Nothing
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -18,7 +18,7 @@
 module Data.Packed.Internal.Matrix(
     Matrix(..), rows, cols,
     MatrixOrder(..), orderOf,
-    createMatrix, withMatrix, mat,
+    createMatrix, mat,
     cmat, fmat,
     toLists, flatten, reshape,
     Element(..),
@@ -29,7 +29,7 @@
     liftMatrix, liftMatrix2,
     (@@>),
     saveMatrix,
-    fromComplex, toComplex, conj,
+    fromComplexV, toComplexV, conjV,
     singleton
 ) where
 
@@ -38,7 +38,7 @@
 import Data.Packed.Internal.Vector
 
 import Foreign hiding (xor)
-import Complex
+import Data.Complex
 import Foreign.C.Types
 import Foreign.C.String
 
@@ -115,11 +115,11 @@
 fmat MC {irows = r, icols = c, cdat = d } = MF {irows = r, icols = c, fdat = transdata c d r}
 
 -- C-Haskell matrix adapter
-mat :: Adapt (CInt -> CInt -> Ptr t -> r) (Matrix t) r
-mat = withMatrix
+-- mat :: Adapt (CInt -> CInt -> Ptr t -> r) (Matrix t) r
 
-withMatrix a f =
-    withForeignPtr (fptr (xdat a)) $ \p -> do
+mat :: (Storable t) => Matrix t -> (((CInt -> CInt -> Ptr t -> t1) -> t1) -> IO b) -> IO b
+mat a f =
+    unsafeWith (xdat a) $ \p -> do
         let m g = do
             g (fi (rows a)) (fi (cols a)) p
         f m
@@ -273,8 +273,8 @@
         then v
         else unsafePerformIO $ do
                 w <- createVector (r2*c2)
-                withForeignPtr (fptr v) $ \p ->
-                    withForeignPtr (fptr w) $ \q -> do
+                unsafeWith v $ \p ->
+                    unsafeWith w $ \q -> do
                         let go (-1) _ = return ()
                             go !i (-1) = go (i-1) (c1-1)
                             go !i !j = do x <- peekElemOff p (i*c1+j)
@@ -300,8 +300,8 @@
         then d
         else unsafePerformIO $ do
             v <- createVector (dim d)
-            withForeignPtr (fptr d) $ \pd ->
-                withForeignPtr (fptr v) $ \pv ->
+            unsafeWith d $ \pd ->
+                unsafeWith v $ \pv ->
                     fun (fi r1) (fi c1) pd (fi r2) (fi c2) pv // check "transdataAux"
             return v
   where r1 = dim d `div` c1
@@ -314,7 +314,7 @@
 
 constant' v n = unsafePerformIO $ do
     w <- createVector n
-    withForeignPtr (fptr w) $ \p -> do
+    unsafeWith w $ \p -> do
         let go (-1) = return ()
             go !k = pokeElemOff p k v >> go (k-1)
         go (n-1)
@@ -352,8 +352,8 @@
 
 subMatrix'' (r0,c0) (rt,ct) c v = unsafePerformIO $ do
     w <- createVector (rt*ct)
-    withForeignPtr (fptr v) $ \p ->
-        withForeignPtr (fptr w) $ \q -> do
+    unsafeWith v $ \p ->
+        unsafeWith w $ \q -> do
             let go (-1) _ = return ()
                 go !i (-1) = go (i-1) (ct-1)
                 go !i !j = do x <- peekElemOff p ((i+r0)*c+j+c0)
@@ -368,16 +368,16 @@
 --------------------------------------------------------------------------
 
 -- | obtains the complex conjugate of a complex vector
-conj :: Vector (Complex Double) -> Vector (Complex Double)
-conj = mapVector conjugate
+conjV :: Vector (Complex Double) -> Vector (Complex Double)
+conjV = mapVector conjugate
 
 -- | creates a complex vector from vectors with real and imaginary parts
-toComplex :: (Vector Double, Vector Double) ->  Vector (Complex Double)
-toComplex (r,i) = asComplex $ flatten $ fromColumns [r,i]
+toComplexV :: (Vector Double, Vector Double) ->  Vector (Complex Double)
+toComplexV (r,i) = asComplex $ flatten $ fromColumns [r,i]
 
 -- | the inverse of 'toComplex'
-fromComplex :: Vector (Complex Double) -> (Vector Double, Vector Double)
-fromComplex z = (r,i) where
+fromComplexV :: Vector (Complex Double) -> (Vector Double, Vector Double)
+fromComplexV z = (r,i) where
     [r,i] = toColumns $ reshape 2 $ asReal z
 
 --------------------------------------------------------------------------
diff --git a/lib/Data/Packed/Internal/Signatures.hs b/lib/Data/Packed/Internal/Signatures.hs
--- a/lib/Data/Packed/Internal/Signatures.hs
+++ b/lib/Data/Packed/Internal/Signatures.hs
@@ -15,7 +15,7 @@
 module Data.Packed.Internal.Signatures where
 
 import Foreign
-import Complex
+import Data.Complex
 import Foreign.C.Types
 
 type PD = Ptr Double                            --
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -12,18 +12,20 @@
 -- Vector implementation
 --
 -----------------------------------------------------------------------------
--- #hide
 
 module Data.Packed.Internal.Vector (
-    Vector(..), dim,
+    Vector, dim,
     fromList, toList, (|>),
-    join, (@>), safe, at, at', subVector,
+    join, (@>), safe, at, at', subVector, takesV,
     mapVector, zipVector,
     foldVector, foldVectorG, foldLoop,
-    createVector, withVector, vec,
+    createVector, vec,
     asComplex, asReal,
     fwriteVector, freadVector, fprintfVector, fscanfVector,
-    cloneVector
+    cloneVector,
+    unsafeToForeignPtr,
+    unsafeFromForeignPtr,
+    unsafeWith
 ) where
 
 import Data.Packed.Internal.Common
@@ -31,7 +33,7 @@
 import Foreign
 import Foreign.C.String
 import Foreign.C.Types(CInt,CChar)
-import Complex
+import Data.Complex
 import Control.Monad(when)
 
 #if __GLASGOW_HASKELL__ >= 605
@@ -45,31 +47,63 @@
 import GHC.IOBase
 #endif
 
--- | A one-dimensional array of objects stored in a contiguous memory block.
+#ifdef VECTOR
+import qualified Data.Vector.Storable as Vector
+import Data.Vector.Storable(Vector,
+                            unsafeToForeignPtr,
+                            unsafeFromForeignPtr,
+                            unsafeWith)
+#endif
+
+#ifdef VECTOR
+
+-- | Number of elements
+dim :: (Storable t) => Vector t -> Int
+dim = Vector.length
+
+#else
+
+-- | One-dimensional array of objects stored in a contiguous memory block.
 data Vector t =
-    V { idim  :: {-# UNPACK #-} !Int              -- ^ number of elements
-      , fptr :: {-# UNPACK #-} !(ForeignPtr t)    -- ^ foreign pointer to the memory block
+    V { ioff :: {-# UNPACK #-} !Int              -- ^ offset of first element
+      , idim :: {-# UNPACK #-} !Int              -- ^ number of elements
+      , fptr :: {-# UNPACK #-} !(ForeignPtr t)   -- ^ foreign pointer to the memory block
       }
 
+unsafeToForeignPtr :: Vector a -> (ForeignPtr a, Int, Int)
+unsafeToForeignPtr v = (fptr v, ioff v, idim v)
+
+-- | Same convention as in Roman Leshchinskiy's vector package.
+unsafeFromForeignPtr :: ForeignPtr a -> Int -> Int -> Vector a
+unsafeFromForeignPtr fp i n | n > 0 = V {ioff = i, idim = n, fptr = fp}
+                            | otherwise = error "unsafeFromForeignPtr with dim < 1"
+
+unsafeWith (V i _ fp) m = withForeignPtr fp $ \p -> m (p `advancePtr` i)
+{-# INLINE unsafeWith #-}
+
 -- | Number of elements
-dim :: Vector t -> Int
+dim :: (Storable t) => Vector t -> Int
 dim = idim
 
--- C-Haskell vector adapter
-vec :: Adapt (CInt -> Ptr t -> r) (Vector t) r
-vec = withVector
+#endif
 
-withVector (V n fp) f = withForeignPtr fp $ \p -> do
+
+-- C-Haskell vector adapter
+-- vec :: Adapt (CInt -> Ptr t -> r) (Vector t) r
+vec :: (Storable t) => Vector t -> (((CInt -> Ptr t -> t1) -> t1) -> IO b) -> IO b
+vec x f = unsafeWith x $ \p -> do
     let v g = do
-        g (fi n) p
+        g (fi $ dim x) p
     f v
+{-# INLINE vec #-}
 
+
 -- allocates memory for a new vector
 createVector :: Storable a => Int -> IO (Vector a)
 createVector n = do
     when (n <= 0) $ error ("trying to createVector of dim "++show n)
     fp <- doMalloc undefined
-    return $ V n fp
+    return $ unsafeFromForeignPtr fp 0 n
   where
     --
     -- Use the much cheaper Haskell heap allocated storage
@@ -92,11 +126,10 @@
 fromList :: Storable a => [a] -> Vector a
 fromList l = unsafePerformIO $ do
     v <- createVector (length l)
-    let f _ p = pokeArray p l >> return 0
-    app1 f vec v "fromList"
+    unsafeWith v $ \ p -> pokeArray p l
     return v
 
-safeRead v = inlinePerformIO . withForeignPtr (fptr v)
+safeRead v = inlinePerformIO . unsafeWith v
 {-# INLINE safeRead #-}
 
 inlinePerformIO :: IO a -> a
@@ -161,14 +194,27 @@
                         -> Int       -- ^ number of elements to extract
                         -> Vector t  -- ^ source
                         -> Vector t  -- ^ result
-subVector k l (v@V {idim=n})
+
+#ifdef VECTOR
+
+subVector = Vector.slice
+
+#else
+
+subVector k l v@V{idim = n, ioff = i}
     | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range"
+    | otherwise = v {idim = l, ioff = i+k}
+
+subVectorCopy k l (v@V {idim=n})
+    | k<0 || k >= n || k+l > n || l < 0 = error "subVector out of range"
     | otherwise = unsafePerformIO $ do
         r <- createVector l
         let f _ s _ d = copyArray d (advancePtr s k) l >> return 0
         app2 f vec v vec r "subVector"
         return r
 
+#endif
+
 {- | Reads a vector position:
 
 @> fromList [0..9] \@\> 7
@@ -191,28 +237,49 @@
 join [v] = v
 join as = unsafePerformIO $ do
     let tot = sum (map dim as)
-    r@V {fptr = p} <- createVector tot
-    withForeignPtr p $ \ptr ->
+    r <- createVector tot
+    unsafeWith r $ \ptr ->
         joiner as tot ptr
     return r
   where joiner [] _ _ = return ()
-        joiner (V {idim = n, fptr = b} : cs) _ p = do
-            withForeignPtr b $ \pb -> copyArray p pb n
+        joiner (v:cs) _ p = do
+            let n = dim v
+            unsafeWith v $ \pb -> copyArray p pb n
             joiner cs 0 (advancePtr p n)
 
 
+{- | Extract consecutive subvectors of the given sizes.
+
+@> takesV [3,4] (linspace 10 (1,10))
+[3 |> [1.0,2.0,3.0],4 |> [4.0,5.0,6.0,7.0]]@
+
+-}
+takesV :: Storable t => [Int] -> Vector t -> [Vector t]
+takesV ms w | sum ms > dim w = error $ "takesV " ++ show ms ++ " on dim = " ++ (show $ dim w)
+            | otherwise = go ms w
+    where go [] _ = []
+          go (n:ns) v = subVector 0 n v
+                      : go ns (subVector n (dim v - n) v)
+
+---------------------------------------------------------------
+
 -- | transforms a complex vector into a real vector with alternating real and imaginary parts 
 asReal :: Vector (Complex Double) -> Vector Double
-asReal v = V { idim = 2*dim v, fptr =  castForeignPtr (fptr v) }
+--asReal v = V { ioff = 2*ioff v, idim = 2*dim v, fptr =  castForeignPtr (fptr v) }
+asReal v = unsafeFromForeignPtr (castForeignPtr fp) (2*i) (2*n)
+    where (fp,i,n) = unsafeToForeignPtr v
 
 -- | transforms a real vector into a complex vector with alternating real and imaginary parts
 asComplex :: Vector Double -> Vector (Complex Double)
-asComplex v = V { idim = dim v `div` 2, fptr =  castForeignPtr (fptr v) }
+--asComplex v = V { ioff = ioff v `div` 2, idim = dim v `div` 2, fptr =  castForeignPtr (fptr v) }
+asComplex v = unsafeFromForeignPtr (castForeignPtr fp) (i `div` 2) (n `div` 2)
+    where (fp,i,n) = unsafeToForeignPtr v
 
 ----------------------------------------------------------------
 
 cloneVector :: Storable t => Vector t -> IO (Vector t)
-cloneVector (v@V {idim=n}) = do
+cloneVector v = do
+        let n = dim v
         r <- createVector n
         let f _ s _ d =  copyArray d s n >> return 0
         app2 f vec v vec r "cloneVector"
@@ -224,8 +291,8 @@
 mapVector :: (Storable a, Storable b) => (a-> b) -> Vector a -> Vector b
 mapVector f v = unsafePerformIO $ do
     w <- createVector (dim v)
-    withForeignPtr (fptr v) $ \p ->
-        withForeignPtr (fptr w) $ \q -> do
+    unsafeWith v $ \p ->
+        unsafeWith w $ \q -> do
             let go (-1) = return ()
                 go !k = do x <- peekElemOff p k
                            pokeElemOff      q k (f x)
@@ -239,9 +306,9 @@
 zipVector f u v = unsafePerformIO $ do
     let n = min (dim u) (dim v)
     w <- createVector n
-    withForeignPtr (fptr u) $ \pu ->
-        withForeignPtr (fptr v) $ \pv ->
-            withForeignPtr (fptr w) $ \pw -> do
+    unsafeWith u $ \pu ->
+        unsafeWith v $ \pv ->
+            unsafeWith w $ \pw -> do
                 let go (-1) = return ()
                     go !k = do x <- peekElemOff pu k
                                y <- peekElemOff pv k
@@ -252,7 +319,7 @@
 {-# INLINE zipVector #-}
 
 foldVector f x v = unsafePerformIO $
-    withForeignPtr (fptr (v::Vector Double)) $ \p -> do
+    unsafeWith (v::Vector Double) $ \p -> do
         let go (-1) s = return s
             go !k !s = do y <- peekElemOff p k
                           go (k-1::Int) (f y s)
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.Packed.Matrix
@@ -13,7 +14,7 @@
 -----------------------------------------------------------------------------
 
 module Data.Packed.Matrix (
-    Element,
+    Element, Container(..),
     Matrix,rows,cols,
     (><),
     trans,
@@ -22,7 +23,8 @@
     (@@>),
     asRow, asColumn,
     fromRows, toRows, fromColumns, toColumns,
-    fromBlocks, repmat,
+    fromBlocks, toBlocks, toBlocksEvery,
+    repmat,
     flipud, fliprl,
     subMatrix, takeRows, dropRows, takeColumns, dropColumns,
     extractRows,
@@ -291,21 +293,6 @@
           o = floor $ maximum $ map (logBase 10 . abs) $ toList $ flatten t
           fmt = '%':show (dec+3) ++ '.':show dec ++"f"
 
-{- | Show a vector using a function for showing matrices.
-
-@disp = putStr . vecdisp (dispf 2)
-
-\> disp (linspace 10 (0,1))
-10 |> 0.00  0.11  0.22  0.33  0.44  0.56  0.67  0.78  0.89  1.00
-@
--}
-vecdisp :: (Element t) => (Matrix t -> String) -> Vector t -> String
-vecdisp f v
-    = ((show (dim v) ++ " |> ") ++) . (++"\n")
-    . unwords . lines .  tail . dropWhile (not . (`elem` " \n"))
-    . f . trans . reshape 1
-    $ v
-
 -- | Tool to display matrices with latex syntax.
 latexFormat :: String -- ^ type of braces: \"matrix\", \"bmatrix\", \"pmatrix\", etc.
             -> String -- ^ Formatted matrix, with elements separated by spaces and newlines
@@ -412,4 +399,72 @@
 compat' m1 m2 = rows m1 == 1 && cols m1 == 1
              || rows m2 == 1 && cols m2 == 1
              || rows m1 == rows m2 && cols m1 == cols m2
+
+------------------------------------------------------------
+
+toBlockRows [r] m | r == rows m = [m]
+toBlockRows rs m = map (reshape (cols m)) (takesV szs (flatten m))
+    where szs = map (* cols m) rs
+
+toBlockCols [c] m | c == cols m = [m]
+toBlockCols cs m = map trans . toBlockRows cs . trans $ m
+
+-- | Partition a matrix into blocks with the given numbers of rows and columns.
+-- The remaining rows and columns are discarded.
+toBlocks :: (Element t) => [Int] -> [Int] -> Matrix t -> [[Matrix t]]
+toBlocks rs cs m = map (toBlockCols cs) . toBlockRows rs $ m
+
+-- | Fully partition a matrix into blocks of the same size. If the dimensions are not
+-- a multiple of the given size the last blocks will be smaller.
+toBlocksEvery :: (Element t) => Int -> Int -> Matrix t -> [[Matrix t]]
+toBlocksEvery r c m = toBlocks rs cs m where
+    (qr,rr) = rows m `divMod` r
+    (qc,rc) = cols m `divMod` c
+    rs = replicate qr r ++ if rr > 0 then [rr] else []
+    cs = replicate qc c ++ if rc > 0 then [rc] else []
+
+-------------------------------------------------------------------
+
+-- | conversion utilities
+class (Element e) => Container c e where
+    toComplex   :: RealFloat e => (c e, c e) -> c (Complex e)
+    fromComplex :: RealFloat e => c (Complex e) -> (c e, c e)
+    comp        :: RealFloat e => c e -> c (Complex e)
+    conj        :: RealFloat e => c (Complex e) -> c (Complex e)
+    real        :: c Double -> c e
+    complex     :: c e -> c (Complex Double)
+
+instance Container Vector Double where
+    toComplex = toComplexV
+    fromComplex = fromComplexV
+    comp v = toComplex (v,constant 0 (dim v))
+    conj = conjV
+    real = id
+    complex = comp
+
+instance Container Vector (Complex Double) where
+    toComplex = undefined -- can't match
+    fromComplex = undefined
+    comp = undefined
+    conj = undefined
+    real = comp
+    complex = id
+
+instance Container Matrix Double where
+    toComplex = uncurry $ liftMatrix2 $ curry toComplex
+    fromComplex z = (reshape c r, reshape c i)
+        where (r,i) = fromComplex (flatten z)
+              c = cols z
+    comp = liftMatrix comp
+    conj = liftMatrix conj
+    real = id
+    complex = comp
+
+instance Container Matrix (Complex Double) where
+    toComplex = undefined
+    fromComplex = undefined
+    comp = undefined
+    conj = undefined
+    real = comp
+    complex = id
 
diff --git a/lib/Data/Packed/Random.hs b/lib/Data/Packed/Random.hs
--- a/lib/Data/Packed/Random.hs
+++ b/lib/Data/Packed/Random.hs
@@ -20,10 +20,9 @@
 ) where
 
 import Numeric.GSL.Vector
-import Data.Packed
-import Numeric.LinearAlgebra.Linear
+import Data.Packed.Matrix
+import Data.Packed.Vector
 import Numeric.LinearAlgebra.Algorithms
-import Numeric.LinearAlgebra.Instances()
 import Numeric.LinearAlgebra.Interface
 
 -- | Obtains a matrix whose rows are pseudorandom samples from a multivariate
@@ -34,12 +33,10 @@
                -> Matrix Double -- ^ covariance matrix
                -> Matrix Double -- ^ result
 gaussianSample seed n med cov = m where
-    (l,v) = eigSH' cov
-    c = dim l
+    c = dim med
     meds = constant 1 n `outer` med
     rs = reshape c $ randomVector seed Gaussian (c * n)
-    ds = sqrt (abs l)
-    m = rs <> (diag ds <> trans v) + meds
+    m = rs <> cholSH cov + meds
 
 -- | Obtains a matrix whose rows are pseudorandom samples from a multivariate
 -- uniform distribution.
@@ -50,7 +47,6 @@
 uniformSample seed n rgs = m where
     (as,bs) = unzip rgs
     a = fromList as
-    b = fromList bs
     cs = zipWith subtract as bs
     d = dim a
     dat = toRows $ reshape n $ randomVector seed Uniform (n*d)
diff --git a/lib/Data/Packed/ST.hs b/lib/Data/Packed/ST.hs
--- a/lib/Data/Packed/ST.hs
+++ b/lib/Data/Packed/ST.hs
@@ -37,11 +37,11 @@
 
 {-# INLINE ioReadV #-}
 ioReadV :: Storable t => Vector t -> Int -> IO t
-ioReadV v k = withForeignPtr (fptr v) $ \s -> peekElemOff s k
+ioReadV v k = unsafeWith v $ \s -> peekElemOff s k
 
 {-# INLINE ioWriteV #-}
 ioWriteV :: Storable t => Vector t -> Int -> t -> IO ()
-ioWriteV v k x = withForeignPtr (fptr v) $ \s -> pokeElemOff s k x
+ioWriteV v k x = unsafeWith v $ \s -> pokeElemOff s k x
 
 newtype STVector s t = STVector (Vector t)
 
diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs
--- a/lib/Data/Packed/Vector.hs
+++ b/lib/Data/Packed/Vector.hs
@@ -16,7 +16,7 @@
     Vector,
     fromList, (|>), toList, buildVector,
     dim, (@>),
-    subVector, join,
+    subVector, takesV, join,
     constant, linspace,
     vecdisp,
     vectorMax, vectorMin, vectorMaxIndex, vectorMinIndex,
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs
--- a/lib/Graphics/Plot.hs
+++ b/lib/Graphics/Plot.hs
@@ -24,14 +24,14 @@
 
     matrixToPGM, imshow,
 
-    gnuplotX, gnuplotpdf
+    gnuplotX, gnuplotpdf, gnuplotWin
 
 ) where
 
 import Data.Packed
 import Numeric.LinearAlgebra(outer)
 import Data.List(intersperse)
-import System
+import System.Process (system)
 
 size = dim
 
@@ -202,5 +202,21 @@
     gnuplot cmd = do
         writeFile "gnuplotcommand" cmd
         _ <- system "gnuplot gnuplotcommand"
+        _ <- system "rm gnuplotcommand"
+        return ()
+
+gnuplotWin :: String -> String -> [([[Double]], String)] -> IO ()
+gnuplotWin title command ds = gnuplot (prelude ++ command ++" "++ draw) where
+    (dats,defs) = unzip ds
+    draw = concat (intersperse ", " (map ("\"-\" "++) defs)) ++ "\n" ++
+           concatMap pr dats
+
+    pr = (++"e\n") . unlines . map (unwords . (map show))
+
+    prelude = "set title \""++title++"\";"
+
+    gnuplot cmd = do
+        writeFile "gnuplotcommand" cmd
+        _ <- system "gnuplot -persist gnuplotcommand"
         _ <- system "rm gnuplotcommand"
         return ()
diff --git a/lib/Numeric/GSL.hs b/lib/Numeric/GSL.hs
--- a/lib/Numeric/GSL.hs
+++ b/lib/Numeric/GSL.hs
@@ -8,8 +8,10 @@
 Stability   :  provisional
 Portability :  uses -fffi and -fglasgow-exts
 
-This module reexports all the available GSL functions (except those in "Numeric.LinearAlgebra").
+This module reexports all available GSL functions.
 
+The GSL special functions are in the separate package hmatrix-special.
+
 -}
 
 module Numeric.GSL (
@@ -20,20 +22,20 @@
 , module Numeric.GSL.Minimization
 , module Numeric.GSL.Root
 , module Numeric.GSL.ODE
-, module Numeric.GSL.Special
-, module Complex
+, module Numeric.GSL.Fitting
+, module Data.Complex
 , setErrorHandlerOff
 ) where
 
 import Numeric.GSL.Integration
 import Numeric.GSL.Differentiation
-import Numeric.GSL.Special
 import Numeric.GSL.Fourier
 import Numeric.GSL.Polynomials
 import Numeric.GSL.Minimization
 import Numeric.GSL.Root
 import Numeric.GSL.ODE
-import Complex
+import Numeric.GSL.Fitting
+import Data.Complex
 
 
 -- | This action removes the GSL default error handler (which aborts the program), so that
diff --git a/lib/Numeric/GSL/Fitting.hs b/lib/Numeric/GSL/Fitting.hs
new file mode 100644
--- /dev/null
+++ b/lib/Numeric/GSL/Fitting.hs
@@ -0,0 +1,175 @@
+{- |
+Module      :  Numeric.GSL.Fitting
+Copyright   :  (c) Alberto Ruiz 2010
+License     :  GPL
+
+Maintainer  :  Alberto Ruiz (aruiz at um dot es)
+Stability   :  provisional
+Portability :  uses ffi
+
+Nonlinear Least-Squares Fitting
+
+<http://www.gnu.org/software/gsl/manual/html_node/Nonlinear-Least_002dSquares-Fitting.html>
+
+The example program in the GSL manual (see examples/fitting.hs):
+
+@dat = [
+ ([0.0],([6.0133918608118675],0.1)),
+ ([1.0],([5.5153769909966535],0.1)),
+ ([2.0],([5.261094606015287],0.1)),
+ ...
+ ([39.0],([1.0619821710802808],0.1))]
+
+expModel [a,lambda,b] [t] = [a * exp (-lambda * t) + b]
+
+expModelDer [a,lambda,b] [t] = [[exp (-lambda * t), -t * a * exp(-lambda*t) , 1]]
+
+(sol,path) = fitModelScaled 1E-4 1E-4 20 (expModel, expModelDer) dat [1,0,0]
+
+\> path
+(6><5)
+ [ 1.0,  76.45780563978782, 1.6465931240727802, 1.8147715267618197e-2, 0.6465931240727797
+ , 2.0, 37.683816318260355,  2.858760367632973,  8.092094813253975e-2, 1.4479636296208662
+ , 3.0,    9.5807893736187,  4.948995119561291,   0.11942927999921617, 1.0945766509238248
+ , 4.0,  5.630494933603935,  5.021755718065913,   0.10287787128056883, 1.0338835440862608
+ , 5.0,  5.443976278682909,  5.045204331329302,   0.10405523433131504,  1.019416067207375
+ , 6.0, 5.4439736648994685,  5.045357818922331,   0.10404905846029407, 1.0192487112786812 ]
+\> sol
+[(5.045357818922331,6.027976702418132e-2),
+(0.10404905846029407,3.157045047172834e-3),
+(1.0192487112786812,3.782067731353722e-2)]@
+
+-}
+-----------------------------------------------------------------------------
+
+module Numeric.GSL.Fitting (
+    -- * Levenberg-Marquardt
+    nlFitting, FittingMethod(..),
+    -- * Utilities
+    fitModelScaled, fitModel
+) where
+
+import Data.Packed.Internal
+import Numeric.LinearAlgebra
+import Foreign
+import Foreign.C.Types(CInt)
+import Numeric.GSL.Internal
+
+-------------------------------------------------------------------------
+
+data 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.
+                   | 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.
+        deriving (Enum,Eq,Show,Bounded)
+
+
+-- | Nonlinear multidimensional least-squares fitting.
+nlFitting :: FittingMethod
+      -> Double                     -- ^ absolute tolerance
+      -> Double                     -- ^ relative tolerance
+      -> Int                        -- ^ maximum number of iterations allowed
+      -> (Vector Double -> Vector Double)     -- ^ function to be minimized
+      -> (Vector Double -> Matrix Double)   -- ^ Jacobian
+      -> Vector Double                   -- ^ starting point
+      -> (Vector Double, Matrix Double)  -- ^ solution vector and optimization path
+
+nlFitting method epsabs epsrel maxit fun jac xinit = nlFitGen (fi (fromEnum method)) fun jac xinit epsabs epsrel maxit
+
+nlFitGen m f jac xiv epsabs epsrel maxit = unsafePerformIO $ do
+    let p   = dim xiv
+        n   = dim (f xiv)
+    fp <- mkVecVecfun (aux_vTov (checkdim1 n p . f))
+    jp <- mkVecMatfun (aux_vTom (checkdim2 n p . jac))
+    rawpath <- createMatrix RowMajor maxit (2+p)
+    app2 (c_nlfit m fp jp epsabs epsrel (fi maxit) (fi n)) vec xiv mat rawpath "c_nlfit"
+    let it = round (rawpath @@> (maxit-1,0))
+        path = takeRows it rawpath
+        [sol] = toRows $ dropRows (it-1) path
+    freeHaskellFunPtr fp
+    freeHaskellFunPtr jp
+    return (subVector 2 p sol, path)
+
+foreign import ccall "nlfit"
+    c_nlfit:: CInt -> FunPtr TVV -> FunPtr TVM -> Double -> Double -> CInt -> CInt -> TVM
+
+-------------------------------------------------------
+
+checkdim1 n _p v
+    | dim v == n = v
+    | otherwise = error $ "Error: "++ show n
+                        ++ " components expected in the result of the function supplied to nlFitting"
+
+checkdim2 n p m
+    | rows m == n && cols m == p = m
+    | otherwise = error $ "Error: "++ show n ++ "x" ++ show p
+                        ++ " Jacobian expected in nlFitting"
+
+------------------------------------------------------------
+
+err (model,deriv) dat vsol = zip sol errs where
+    sol = toList vsol
+    c = max 1 (chi/sqrt (fromIntegral dof))
+    dof = length dat - (rows cov)
+    chi = pnorm PNorm2 (fromList $ cost (resMs model) dat sol)
+    js = fromLists $ jacobian (resDs deriv) dat sol
+    cov = inv $ trans js <> js
+    errs = toList $ scalar c * sqrt (takeDiag cov)
+
+
+
+-- | Higher level interface to 'nlFitting' 'LevenbergMarquardtScaled'. The optimization function and
+-- Jacobian are automatically built from a model f vs x = y and its derivatives, and a list of
+-- instances (x, (y,sigma)) to be fitted.
+
+fitModelScaled
+         :: Double -- ^ absolute tolerance
+         -> Double -- ^ relative tolerance
+         -> Int    -- ^ maximum number of iterations allowed
+         -> ([Double] -> x -> [Double], [Double] -> x -> [[Double]]) -- ^ (model, derivatives)
+         -> [(x, ([Double], Double))] -- ^ instances
+         -> [Double] -- ^ starting point
+         -> ([(Double, Double)], Matrix Double) -- ^ (solution, error) and optimization path
+fitModelScaled epsabs epsrel maxit (model,deriv) dt xin = (err (model,deriv) dt sol, path) where
+    (sol,path) = nlFitting LevenbergMarquardtScaled epsabs epsrel maxit
+                (fromList . cost (resMs model) dt . toList)
+                (fromLists . jacobian (resDs deriv) dt . toList)
+                (fromList xin)
+
+
+
+-- | Higher level interface to 'nlFitting' 'LevenbergMarquardt'. The optimization function and
+-- Jacobian are automatically built from a model f vs x = y and its derivatives, and a list of
+-- instances (x,y) to be fitted.
+
+fitModel :: Double -- ^ absolute tolerance
+         -> Double -- ^ relative tolerance
+         -> Int    -- ^ maximum number of iterations allowed
+         -> ([Double] -> x -> [Double], [Double] -> x -> [[Double]]) -- ^ (model, derivatives)
+         -> [(x, [Double])]  -- ^ instances
+         -> [Double] -- ^ starting point
+         -> ([Double], Matrix Double) -- ^ solution and optimization path
+fitModel epsabs epsrel maxit (model,deriv) dt xin = (toList sol, path) where
+    (sol,path) = nlFitting LevenbergMarquardt epsabs epsrel maxit
+                (fromList . cost (resM model) dt . toList)
+                (fromLists . jacobian (resD deriv) dt . toList)
+                (fromList xin)
+
+cost model ds vs = concatMap (model vs) ds
+
+jacobian modelDer ds vs = concatMap (modelDer vs) ds
+
+-- | Model-to-residual for association pairs with sigma, to be used with 'fitModel'.
+resMs :: ([Double] -> x -> [Double]) -> [Double] -> (x, ([Double], Double)) -> [Double]
+resMs m v = \(x,(ys,s)) -> zipWith (g s) (m v x) ys where g s a b = (a-b)/s
+
+-- | Associated derivative for 'resMs'.
+resDs :: ([Double] -> x -> [[Double]]) -> [Double] -> (x, ([Double], Double)) -> [[Double]]
+resDs m v = \(x,(_,s)) -> map (map (/s)) (m v x)
+
+-- | Model-to-residual for association pairs, to be used with 'fitModel'. It is equivalent
+-- to 'resMs' with all sigmas = 1.
+resM :: ([Double] -> x -> [Double]) -> [Double] -> (x, [Double]) -> [Double]
+resM m v = \(x,ys) -> zipWith g (m v x) ys where g a b = a-b
+
+-- | Associated derivative for 'resM'.
+resD :: ([Double] -> x -> [[Double]]) -> [Double] -> (x, [Double]) -> [[Double]]
+resD m v = \(x,_) -> m v x
diff --git a/lib/Numeric/GSL/Fourier.hs b/lib/Numeric/GSL/Fourier.hs
--- a/lib/Numeric/GSL/Fourier.hs
+++ b/lib/Numeric/GSL/Fourier.hs
@@ -21,7 +21,7 @@
 ) where
 
 import Data.Packed.Internal
-import Complex
+import Data.Complex
 import Foreign
 import Foreign.C.Types(CInt)
 
diff --git a/lib/Numeric/GSL/Internal.hs b/lib/Numeric/GSL/Internal.hs
--- a/lib/Numeric/GSL/Internal.hs
+++ b/lib/Numeric/GSL/Internal.hs
@@ -35,12 +35,12 @@
 
 aux_vTov :: (Vector Double -> Vector Double) -> TVV
 aux_vTov f n p nr r = g where
-    V {fptr = pr} = f x
+    v = f x
     x = createV (fromIntegral n) copy "aux_vTov"
     copy n' q = do
         copyArray q p (fromIntegral n')
         return 0
-    g = do withForeignPtr pr $ \p' -> copyArray r p' (fromIntegral nr)
+    g = do unsafeWith v $ \p' -> copyArray r p' (fromIntegral nr)
            return 0
 
 foreign import ccall "wrapper"
@@ -51,12 +51,12 @@
 
 aux_vTom :: (Vector Double -> Matrix Double) -> TVM
 aux_vTom f n p rr cr r = g where
-    V {fptr = pr} = flatten $ f x
+    v = flatten $ f x
     x = createV (fromIntegral n) copy "aux_vTov"
     copy n' q = do
         copyArray q p (fromIntegral n')
         return 0
-    g = do withForeignPtr pr $ \p' -> copyArray r p' (fromIntegral $ rr*cr)
+    g = do unsafeWith v $ \p' -> copyArray r p' (fromIntegral $ rr*cr)
            return 0
 
 createV n fun msg = unsafePerformIO $ do
diff --git a/lib/Numeric/GSL/Minimization.hs b/lib/Numeric/GSL/Minimization.hs
--- a/lib/Numeric/GSL/Minimization.hs
+++ b/lib/Numeric/GSL/Minimization.hs
@@ -109,7 +109,7 @@
 minimizeV method eps maxit szv f xiv = unsafePerformIO $ do
     let n   = dim xiv
     fp <- mkVecfun (iv f)
-    rawpath <- ww2 withVector xiv withVector szv $ \xiv' szv' ->
+    rawpath <- ww2 vec xiv vec szv $ \xiv' szv' ->
                    createMIO maxit (n+3)
                          (c_minimize (fi (fromEnum method)) fp eps (fi maxit) // xiv' // szv')
                          "minimize"
@@ -166,7 +166,7 @@
         df' = (checkdim1 n . df)
     fp <- mkVecfun (iv f')
     dfp <- mkVecVecfun (aux_vTov df')
-    rawpath <- withVector xiv $ \xiv' ->
+    rawpath <- vec xiv $ \xiv' ->
                     createMIO maxit (n+2)
                          (c_minimizeD (fi (fromEnum method)) fp dfp istep tol eps (fi maxit) // xiv')
                          "minimizeD"
diff --git a/lib/Numeric/GSL/ODE.hs b/lib/Numeric/GSL/ODE.hs
--- a/lib/Numeric/GSL/ODE.hs
+++ b/lib/Numeric/GSL/ODE.hs
@@ -33,7 +33,6 @@
 ) where
 
 import Data.Packed.Internal
-import Data.Packed.Matrix
 import Foreign
 import Foreign.C.Types(CInt)
 import Numeric.GSL.Internal
@@ -64,7 +63,6 @@
           epsAbs = 1.49012e-08
           epsRel = 1.49012e-08
           l2v f = \t -> fromList  . f t . toList
-          l2m f = \t -> fromLists . f t . toList
 
 -- | Evolution of the system with adaptive step-size control.
 odeSolveV
@@ -83,8 +81,8 @@
     jp <- case mbjac of
         Just jac -> mkDoubleVecMatfun (\t -> aux_vTom (checkdim2 n . jac t))
         Nothing  -> return nullFunPtr
-    sol <- withVector xiv $ \xiv' ->
-            withVector (checkTimes ts) $ \ts' ->
+    sol <- vec xiv $ \xiv' ->
+            vec (checkTimes ts) $ \ts' ->
              createMIO (dim ts) n
               (ode_c (fi (fromEnum method)) h epsAbs epsRel fp jp // xiv' // ts' )
               "ode"
diff --git a/lib/Numeric/GSL/Polynomials.hs b/lib/Numeric/GSL/Polynomials.hs
--- a/lib/Numeric/GSL/Polynomials.hs
+++ b/lib/Numeric/GSL/Polynomials.hs
@@ -20,7 +20,7 @@
 ) where
 
 import Data.Packed.Internal
-import Complex
+import Data.Complex
 import Foreign
 
 {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. For example,
diff --git a/lib/Numeric/GSL/Root.hs b/lib/Numeric/GSL/Root.hs
--- a/lib/Numeric/GSL/Root.hs
+++ b/lib/Numeric/GSL/Root.hs
@@ -79,7 +79,7 @@
     let xiv = fromList xi
         n   = dim xiv
     fp <- mkVecVecfun (aux_vTov (checkdim1 n . fromList . f . toList))
-    rawpath <- withVector xiv $ \xiv' ->
+    rawpath <- vec xiv $ \xiv' ->
                    createMIO maxit (2*n+1)
                          (c_root m fp epsabs (fi maxit) // xiv')
                          "root"
@@ -117,7 +117,7 @@
         n   = dim xiv
     fp <- mkVecVecfun (aux_vTov (checkdim1 n . fromList . f . toList))
     jp <- mkVecMatfun (aux_vTom (checkdim2 n . fromLists . jac . toList))
-    rawpath <- withVector xiv $ \xiv' ->
+    rawpath <- vec xiv $ \xiv' ->
                    createMIO maxit (2*n+1)
                          (c_rootj m fp jp epsabs (fi maxit) // xiv')
                          "root"
diff --git a/lib/Numeric/GSL/Special.hs b/lib/Numeric/GSL/Special.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special.hs
+++ /dev/null
@@ -1,76 +0,0 @@
------------------------------------------------------------------------------
-{- |
-Module      :  Numeric.GSL.Special
-Copyright   :  (c) Alberto Ruiz 2006
-License     :  GPL-style
-
-Maintainer  :  Alberto Ruiz (aruiz at um dot es)
-Stability   :  provisional
-Portability :  uses ffi
-
-Wrappers for selected special functions.
-
-<http://www.gnu.org/software/gsl/manual/html_node/Special-Functions.html#Special-Functions>
--}
------------------------------------------------------------------------------
-
-module Numeric.GSL.Special (
-  module Numeric.GSL.Special.Airy
-, module Numeric.GSL.Special.Bessel
-, module Numeric.GSL.Special.Clausen
-, module Numeric.GSL.Special.Coulomb
-, module Numeric.GSL.Special.Coupling
-, module Numeric.GSL.Special.Dawson
-, module Numeric.GSL.Special.Debye
-, module Numeric.GSL.Special.Dilog
-, module Numeric.GSL.Special.Elementary
-, module Numeric.GSL.Special.Ellint
-, module Numeric.GSL.Special.Elljac
-, module Numeric.GSL.Special.Erf
-, module Numeric.GSL.Special.Exp
-, module Numeric.GSL.Special.Expint
-, module Numeric.GSL.Special.Fermi_dirac
-, module Numeric.GSL.Special.Gamma
-, module Numeric.GSL.Special.Gegenbauer
-, module Numeric.GSL.Special.Hyperg
-, module Numeric.GSL.Special.Laguerre
-, module Numeric.GSL.Special.Lambert
-, module Numeric.GSL.Special.Legendre
-, module Numeric.GSL.Special.Log
-, module Numeric.GSL.Special.Pow_int
-, module Numeric.GSL.Special.Psi
-, module Numeric.GSL.Special.Synchrotron
-, module Numeric.GSL.Special.Transport
-, module Numeric.GSL.Special.Trig
-, module Numeric.GSL.Special.Zeta
-)
-where
-
-import Numeric.GSL.Special.Airy
-import Numeric.GSL.Special.Bessel
-import Numeric.GSL.Special.Clausen
-import Numeric.GSL.Special.Coulomb
-import Numeric.GSL.Special.Coupling
-import Numeric.GSL.Special.Dawson
-import Numeric.GSL.Special.Debye
-import Numeric.GSL.Special.Dilog
-import Numeric.GSL.Special.Elementary
-import Numeric.GSL.Special.Ellint
-import Numeric.GSL.Special.Elljac
-import Numeric.GSL.Special.Erf
-import Numeric.GSL.Special.Exp
-import Numeric.GSL.Special.Expint
-import Numeric.GSL.Special.Fermi_dirac
-import Numeric.GSL.Special.Gamma
-import Numeric.GSL.Special.Gegenbauer
-import Numeric.GSL.Special.Hyperg
-import Numeric.GSL.Special.Laguerre
-import Numeric.GSL.Special.Lambert
-import Numeric.GSL.Special.Legendre
-import Numeric.GSL.Special.Log
-import Numeric.GSL.Special.Pow_int
-import Numeric.GSL.Special.Psi
-import Numeric.GSL.Special.Synchrotron
-import Numeric.GSL.Special.Transport
-import Numeric.GSL.Special.Trig
-import Numeric.GSL.Special.Zeta
diff --git a/lib/Numeric/GSL/Special/Airy.hs b/lib/Numeric/GSL/Special/Airy.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Airy.hs
+++ /dev/null
@@ -1,141 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Airy
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_airy.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Airy(
-  airy_Ai_e
-, airy_Ai
-, airy_Bi_e
-, airy_Bi
-, airy_Ai_scaled_e
-, airy_Ai_scaled
-, airy_Bi_scaled_e
-, airy_Bi_scaled
-, airy_Ai_deriv_e
-, airy_Ai_deriv
-, airy_Bi_deriv_e
-, airy_Bi_deriv
-, airy_Ai_deriv_scaled_e
-, airy_Ai_deriv_scaled
-, airy_Bi_deriv_scaled_e
-, airy_Bi_deriv_scaled
-, airy_zero_Ai_e
-, airy_zero_Ai
-, airy_zero_Bi_e
-, airy_zero_Bi
-, airy_zero_Ai_deriv_e
-, airy_zero_Ai_deriv
-, airy_zero_Bi_deriv_e
-, airy_zero_Bi_deriv
-, Precision(..)
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-airy_Ai_e :: Double -> Precision -> (Double,Double)
-airy_Ai_e x mode = createSFR "airy_Ai_e" $ gsl_sf_airy_Ai_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai_e" gsl_sf_airy_Ai_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Ai :: Double -> Precision -> Double
-airy_Ai x mode = gsl_sf_airy_Ai x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai" gsl_sf_airy_Ai :: Double -> Gsl_mode_t -> Double
-
-airy_Bi_e :: Double -> Precision -> (Double,Double)
-airy_Bi_e x mode = createSFR "airy_Bi_e" $ gsl_sf_airy_Bi_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi_e" gsl_sf_airy_Bi_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Bi :: Double -> Precision -> Double
-airy_Bi x mode = gsl_sf_airy_Bi x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi" gsl_sf_airy_Bi :: Double -> Gsl_mode_t -> Double
-
-airy_Ai_scaled_e :: Double -> Precision -> (Double,Double)
-airy_Ai_scaled_e x mode = createSFR "airy_Ai_scaled_e" $ gsl_sf_airy_Ai_scaled_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai_scaled_e" gsl_sf_airy_Ai_scaled_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Ai_scaled :: Double -> Precision -> Double
-airy_Ai_scaled x mode = gsl_sf_airy_Ai_scaled x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai_scaled" gsl_sf_airy_Ai_scaled :: Double -> Gsl_mode_t -> Double
-
-airy_Bi_scaled_e :: Double -> Precision -> (Double,Double)
-airy_Bi_scaled_e x mode = createSFR "airy_Bi_scaled_e" $ gsl_sf_airy_Bi_scaled_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi_scaled_e" gsl_sf_airy_Bi_scaled_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Bi_scaled :: Double -> Precision -> Double
-airy_Bi_scaled x mode = gsl_sf_airy_Bi_scaled x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi_scaled" gsl_sf_airy_Bi_scaled :: Double -> Gsl_mode_t -> Double
-
-airy_Ai_deriv_e :: Double -> Precision -> (Double,Double)
-airy_Ai_deriv_e x mode = createSFR "airy_Ai_deriv_e" $ gsl_sf_airy_Ai_deriv_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai_deriv_e" gsl_sf_airy_Ai_deriv_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Ai_deriv :: Double -> Precision -> Double
-airy_Ai_deriv x mode = gsl_sf_airy_Ai_deriv x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai_deriv" gsl_sf_airy_Ai_deriv :: Double -> Gsl_mode_t -> Double
-
-airy_Bi_deriv_e :: Double -> Precision -> (Double,Double)
-airy_Bi_deriv_e x mode = createSFR "airy_Bi_deriv_e" $ gsl_sf_airy_Bi_deriv_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi_deriv_e" gsl_sf_airy_Bi_deriv_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Bi_deriv :: Double -> Precision -> Double
-airy_Bi_deriv x mode = gsl_sf_airy_Bi_deriv x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi_deriv" gsl_sf_airy_Bi_deriv :: Double -> Gsl_mode_t -> Double
-
-airy_Ai_deriv_scaled_e :: Double -> Precision -> (Double,Double)
-airy_Ai_deriv_scaled_e x mode = createSFR "airy_Ai_deriv_scaled_e" $ gsl_sf_airy_Ai_deriv_scaled_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai_deriv_scaled_e" gsl_sf_airy_Ai_deriv_scaled_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Ai_deriv_scaled :: Double -> Precision -> Double
-airy_Ai_deriv_scaled x mode = gsl_sf_airy_Ai_deriv_scaled x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Ai_deriv_scaled" gsl_sf_airy_Ai_deriv_scaled :: Double -> Gsl_mode_t -> Double
-
-airy_Bi_deriv_scaled_e :: Double -> Precision -> (Double,Double)
-airy_Bi_deriv_scaled_e x mode = createSFR "airy_Bi_deriv_scaled_e" $ gsl_sf_airy_Bi_deriv_scaled_e x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi_deriv_scaled_e" gsl_sf_airy_Bi_deriv_scaled_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-airy_Bi_deriv_scaled :: Double -> Precision -> Double
-airy_Bi_deriv_scaled x mode = gsl_sf_airy_Bi_deriv_scaled x  (precCode mode)
-foreign import ccall "gsl_sf_airy_Bi_deriv_scaled" gsl_sf_airy_Bi_deriv_scaled :: Double -> Gsl_mode_t -> Double
-
-airy_zero_Ai_e :: CInt -> (Double,Double)
-airy_zero_Ai_e s = createSFR "airy_zero_Ai_e" $ gsl_sf_airy_zero_Ai_e s
-foreign import ccall "gsl_sf_airy_zero_Ai_e" gsl_sf_airy_zero_Ai_e :: CInt -> Ptr () -> IO CInt
-
-airy_zero_Ai :: CInt -> Double
-airy_zero_Ai = gsl_sf_airy_zero_Ai
-foreign import ccall "gsl_sf_airy_zero_Ai" gsl_sf_airy_zero_Ai :: CInt -> Double
-
-airy_zero_Bi_e :: CInt -> (Double,Double)
-airy_zero_Bi_e s = createSFR "airy_zero_Bi_e" $ gsl_sf_airy_zero_Bi_e s
-foreign import ccall "gsl_sf_airy_zero_Bi_e" gsl_sf_airy_zero_Bi_e :: CInt -> Ptr () -> IO CInt
-
-airy_zero_Bi :: CInt -> Double
-airy_zero_Bi = gsl_sf_airy_zero_Bi
-foreign import ccall "gsl_sf_airy_zero_Bi" gsl_sf_airy_zero_Bi :: CInt -> Double
-
-airy_zero_Ai_deriv_e :: CInt -> (Double,Double)
-airy_zero_Ai_deriv_e s = createSFR "airy_zero_Ai_deriv_e" $ gsl_sf_airy_zero_Ai_deriv_e s
-foreign import ccall "gsl_sf_airy_zero_Ai_deriv_e" gsl_sf_airy_zero_Ai_deriv_e :: CInt -> Ptr () -> IO CInt
-
-airy_zero_Ai_deriv :: CInt -> Double
-airy_zero_Ai_deriv = gsl_sf_airy_zero_Ai_deriv
-foreign import ccall "gsl_sf_airy_zero_Ai_deriv" gsl_sf_airy_zero_Ai_deriv :: CInt -> Double
-
-airy_zero_Bi_deriv_e :: CInt -> (Double,Double)
-airy_zero_Bi_deriv_e s = createSFR "airy_zero_Bi_deriv_e" $ gsl_sf_airy_zero_Bi_deriv_e s
-foreign import ccall "gsl_sf_airy_zero_Bi_deriv_e" gsl_sf_airy_zero_Bi_deriv_e :: CInt -> Ptr () -> IO CInt
-
-airy_zero_Bi_deriv :: CInt -> Double
-airy_zero_Bi_deriv = gsl_sf_airy_zero_Bi_deriv
-foreign import ccall "gsl_sf_airy_zero_Bi_deriv" gsl_sf_airy_zero_Bi_deriv :: CInt -> Double
diff --git a/lib/Numeric/GSL/Special/Bessel.hs b/lib/Numeric/GSL/Special/Bessel.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Bessel.hs
+++ /dev/null
@@ -1,508 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Bessel
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_bessel.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Bessel(
-  bessel_J0_e
-, bessel_J0
-, bessel_J1_e
-, bessel_J1
-, bessel_Jn_e
-, bessel_Jn
-, bessel_Y0_e
-, bessel_Y0
-, bessel_Y1_e
-, bessel_Y1
-, bessel_Yn_e
-, bessel_Yn
-, bessel_I0_e
-, bessel_I0
-, bessel_I1_e
-, bessel_I1
-, bessel_In_e
-, bessel_In
-, bessel_I0_scaled_e
-, bessel_I0_scaled
-, bessel_I1_scaled_e
-, bessel_I1_scaled
-, bessel_In_scaled_e
-, bessel_In_scaled
-, bessel_K0_e
-, bessel_K0
-, bessel_K1_e
-, bessel_K1
-, bessel_Kn_e
-, bessel_Kn
-, bessel_K0_scaled_e
-, bessel_K0_scaled
-, bessel_K1_scaled_e
-, bessel_K1_scaled
-, bessel_Kn_scaled_e
-, bessel_Kn_scaled
-, bessel_j0_e
-, bessel_j0
-, bessel_j1_e
-, bessel_j1
-, bessel_j2_e
-, bessel_j2
-, bessel_jl_e
-, bessel_jl
-, bessel_y0_e
-, bessel_y0
-, bessel_y1_e
-, bessel_y1
-, bessel_y2_e
-, bessel_y2
-, bessel_yl_e
-, bessel_yl
-, bessel_i0_scaled_e
-, bessel_i0_scaled
-, bessel_i1_scaled_e
-, bessel_i1_scaled
-, bessel_i2_scaled_e
-, bessel_i2_scaled
-, bessel_il_scaled_e
-, bessel_il_scaled
-, bessel_k0_scaled_e
-, bessel_k0_scaled
-, bessel_k1_scaled_e
-, bessel_k1_scaled
-, bessel_k2_scaled_e
-, bessel_k2_scaled
-, bessel_kl_scaled_e
-, bessel_kl_scaled
-, bessel_Jnu_e
-, bessel_Jnu
-, bessel_Ynu_e
-, bessel_Ynu
-, bessel_Inu_scaled_e
-, bessel_Inu_scaled
-, bessel_Inu_e
-, bessel_Inu
-, bessel_Knu_scaled_e
-, bessel_Knu_scaled
-, bessel_Knu_e
-, bessel_Knu
-, bessel_lnKnu_e
-, bessel_lnKnu
-, bessel_zero_J0_e
-, bessel_zero_J0
-, bessel_zero_J1_e
-, bessel_zero_J1
-, bessel_zero_Jnu_e
-, bessel_zero_Jnu
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-bessel_J0_e :: Double -> (Double,Double)
-bessel_J0_e x = createSFR "bessel_J0_e" $ gsl_sf_bessel_J0_e x
-foreign import ccall "gsl_sf_bessel_J0_e" gsl_sf_bessel_J0_e :: Double -> Ptr () -> IO CInt
-
-bessel_J0 :: Double -> Double
-bessel_J0 = gsl_sf_bessel_J0
-foreign import ccall "gsl_sf_bessel_J0" gsl_sf_bessel_J0 :: Double -> Double
-
-bessel_J1_e :: Double -> (Double,Double)
-bessel_J1_e x = createSFR "bessel_J1_e" $ gsl_sf_bessel_J1_e x
-foreign import ccall "gsl_sf_bessel_J1_e" gsl_sf_bessel_J1_e :: Double -> Ptr () -> IO CInt
-
-bessel_J1 :: Double -> Double
-bessel_J1 = gsl_sf_bessel_J1
-foreign import ccall "gsl_sf_bessel_J1" gsl_sf_bessel_J1 :: Double -> Double
-
-bessel_Jn_e :: CInt -> Double -> (Double,Double)
-bessel_Jn_e n x = createSFR "bessel_Jn_e" $ gsl_sf_bessel_Jn_e n x
-foreign import ccall "gsl_sf_bessel_Jn_e" gsl_sf_bessel_Jn_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_Jn :: CInt -> Double -> Double
-bessel_Jn = gsl_sf_bessel_Jn
-foreign import ccall "gsl_sf_bessel_Jn" gsl_sf_bessel_Jn :: CInt -> Double -> Double
-
-bessel_Jn_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-bessel_Jn_array = gsl_sf_bessel_Jn_array
-foreign import ccall "gsl_sf_bessel_Jn_array" gsl_sf_bessel_Jn_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-bessel_Y0_e :: Double -> (Double,Double)
-bessel_Y0_e x = createSFR "bessel_Y0_e" $ gsl_sf_bessel_Y0_e x
-foreign import ccall "gsl_sf_bessel_Y0_e" gsl_sf_bessel_Y0_e :: Double -> Ptr () -> IO CInt
-
-bessel_Y0 :: Double -> Double
-bessel_Y0 = gsl_sf_bessel_Y0
-foreign import ccall "gsl_sf_bessel_Y0" gsl_sf_bessel_Y0 :: Double -> Double
-
-bessel_Y1_e :: Double -> (Double,Double)
-bessel_Y1_e x = createSFR "bessel_Y1_e" $ gsl_sf_bessel_Y1_e x
-foreign import ccall "gsl_sf_bessel_Y1_e" gsl_sf_bessel_Y1_e :: Double -> Ptr () -> IO CInt
-
-bessel_Y1 :: Double -> Double
-bessel_Y1 = gsl_sf_bessel_Y1
-foreign import ccall "gsl_sf_bessel_Y1" gsl_sf_bessel_Y1 :: Double -> Double
-
-bessel_Yn_e :: CInt -> Double -> (Double,Double)
-bessel_Yn_e n x = createSFR "bessel_Yn_e" $ gsl_sf_bessel_Yn_e n x
-foreign import ccall "gsl_sf_bessel_Yn_e" gsl_sf_bessel_Yn_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_Yn :: CInt -> Double -> Double
-bessel_Yn = gsl_sf_bessel_Yn
-foreign import ccall "gsl_sf_bessel_Yn" gsl_sf_bessel_Yn :: CInt -> Double -> Double
-
-bessel_Yn_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-bessel_Yn_array = gsl_sf_bessel_Yn_array
-foreign import ccall "gsl_sf_bessel_Yn_array" gsl_sf_bessel_Yn_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-bessel_I0_e :: Double -> (Double,Double)
-bessel_I0_e x = createSFR "bessel_I0_e" $ gsl_sf_bessel_I0_e x
-foreign import ccall "gsl_sf_bessel_I0_e" gsl_sf_bessel_I0_e :: Double -> Ptr () -> IO CInt
-
-bessel_I0 :: Double -> Double
-bessel_I0 = gsl_sf_bessel_I0
-foreign import ccall "gsl_sf_bessel_I0" gsl_sf_bessel_I0 :: Double -> Double
-
-bessel_I1_e :: Double -> (Double,Double)
-bessel_I1_e x = createSFR "bessel_I1_e" $ gsl_sf_bessel_I1_e x
-foreign import ccall "gsl_sf_bessel_I1_e" gsl_sf_bessel_I1_e :: Double -> Ptr () -> IO CInt
-
-bessel_I1 :: Double -> Double
-bessel_I1 = gsl_sf_bessel_I1
-foreign import ccall "gsl_sf_bessel_I1" gsl_sf_bessel_I1 :: Double -> Double
-
-bessel_In_e :: CInt -> Double -> (Double,Double)
-bessel_In_e n x = createSFR "bessel_In_e" $ gsl_sf_bessel_In_e n x
-foreign import ccall "gsl_sf_bessel_In_e" gsl_sf_bessel_In_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_In :: CInt -> Double -> Double
-bessel_In = gsl_sf_bessel_In
-foreign import ccall "gsl_sf_bessel_In" gsl_sf_bessel_In :: CInt -> Double -> Double
-
-bessel_In_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-bessel_In_array = gsl_sf_bessel_In_array
-foreign import ccall "gsl_sf_bessel_In_array" gsl_sf_bessel_In_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-bessel_I0_scaled_e :: Double -> (Double,Double)
-bessel_I0_scaled_e x = createSFR "bessel_I0_scaled_e" $ gsl_sf_bessel_I0_scaled_e x
-foreign import ccall "gsl_sf_bessel_I0_scaled_e" gsl_sf_bessel_I0_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_I0_scaled :: Double -> Double
-bessel_I0_scaled = gsl_sf_bessel_I0_scaled
-foreign import ccall "gsl_sf_bessel_I0_scaled" gsl_sf_bessel_I0_scaled :: Double -> Double
-
-bessel_I1_scaled_e :: Double -> (Double,Double)
-bessel_I1_scaled_e x = createSFR "bessel_I1_scaled_e" $ gsl_sf_bessel_I1_scaled_e x
-foreign import ccall "gsl_sf_bessel_I1_scaled_e" gsl_sf_bessel_I1_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_I1_scaled :: Double -> Double
-bessel_I1_scaled = gsl_sf_bessel_I1_scaled
-foreign import ccall "gsl_sf_bessel_I1_scaled" gsl_sf_bessel_I1_scaled :: Double -> Double
-
-bessel_In_scaled_e :: CInt -> Double -> (Double,Double)
-bessel_In_scaled_e n x = createSFR "bessel_In_scaled_e" $ gsl_sf_bessel_In_scaled_e n x
-foreign import ccall "gsl_sf_bessel_In_scaled_e" gsl_sf_bessel_In_scaled_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_In_scaled :: CInt -> Double -> Double
-bessel_In_scaled = gsl_sf_bessel_In_scaled
-foreign import ccall "gsl_sf_bessel_In_scaled" gsl_sf_bessel_In_scaled :: CInt -> Double -> Double
-
-bessel_In_scaled_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-bessel_In_scaled_array = gsl_sf_bessel_In_scaled_array
-foreign import ccall "gsl_sf_bessel_In_scaled_array" gsl_sf_bessel_In_scaled_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-bessel_K0_e :: Double -> (Double,Double)
-bessel_K0_e x = createSFR "bessel_K0_e" $ gsl_sf_bessel_K0_e x
-foreign import ccall "gsl_sf_bessel_K0_e" gsl_sf_bessel_K0_e :: Double -> Ptr () -> IO CInt
-
-bessel_K0 :: Double -> Double
-bessel_K0 = gsl_sf_bessel_K0
-foreign import ccall "gsl_sf_bessel_K0" gsl_sf_bessel_K0 :: Double -> Double
-
-bessel_K1_e :: Double -> (Double,Double)
-bessel_K1_e x = createSFR "bessel_K1_e" $ gsl_sf_bessel_K1_e x
-foreign import ccall "gsl_sf_bessel_K1_e" gsl_sf_bessel_K1_e :: Double -> Ptr () -> IO CInt
-
-bessel_K1 :: Double -> Double
-bessel_K1 = gsl_sf_bessel_K1
-foreign import ccall "gsl_sf_bessel_K1" gsl_sf_bessel_K1 :: Double -> Double
-
-bessel_Kn_e :: CInt -> Double -> (Double,Double)
-bessel_Kn_e n x = createSFR "bessel_Kn_e" $ gsl_sf_bessel_Kn_e n x
-foreign import ccall "gsl_sf_bessel_Kn_e" gsl_sf_bessel_Kn_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_Kn :: CInt -> Double -> Double
-bessel_Kn = gsl_sf_bessel_Kn
-foreign import ccall "gsl_sf_bessel_Kn" gsl_sf_bessel_Kn :: CInt -> Double -> Double
-
-bessel_Kn_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-bessel_Kn_array = gsl_sf_bessel_Kn_array
-foreign import ccall "gsl_sf_bessel_Kn_array" gsl_sf_bessel_Kn_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-bessel_K0_scaled_e :: Double -> (Double,Double)
-bessel_K0_scaled_e x = createSFR "bessel_K0_scaled_e" $ gsl_sf_bessel_K0_scaled_e x
-foreign import ccall "gsl_sf_bessel_K0_scaled_e" gsl_sf_bessel_K0_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_K0_scaled :: Double -> Double
-bessel_K0_scaled = gsl_sf_bessel_K0_scaled
-foreign import ccall "gsl_sf_bessel_K0_scaled" gsl_sf_bessel_K0_scaled :: Double -> Double
-
-bessel_K1_scaled_e :: Double -> (Double,Double)
-bessel_K1_scaled_e x = createSFR "bessel_K1_scaled_e" $ gsl_sf_bessel_K1_scaled_e x
-foreign import ccall "gsl_sf_bessel_K1_scaled_e" gsl_sf_bessel_K1_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_K1_scaled :: Double -> Double
-bessel_K1_scaled = gsl_sf_bessel_K1_scaled
-foreign import ccall "gsl_sf_bessel_K1_scaled" gsl_sf_bessel_K1_scaled :: Double -> Double
-
-bessel_Kn_scaled_e :: CInt -> Double -> (Double,Double)
-bessel_Kn_scaled_e n x = createSFR "bessel_Kn_scaled_e" $ gsl_sf_bessel_Kn_scaled_e n x
-foreign import ccall "gsl_sf_bessel_Kn_scaled_e" gsl_sf_bessel_Kn_scaled_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_Kn_scaled :: CInt -> Double -> Double
-bessel_Kn_scaled = gsl_sf_bessel_Kn_scaled
-foreign import ccall "gsl_sf_bessel_Kn_scaled" gsl_sf_bessel_Kn_scaled :: CInt -> Double -> Double
-
-bessel_Kn_scaled_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-bessel_Kn_scaled_array = gsl_sf_bessel_Kn_scaled_array
-foreign import ccall "gsl_sf_bessel_Kn_scaled_array" gsl_sf_bessel_Kn_scaled_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-bessel_j0_e :: Double -> (Double,Double)
-bessel_j0_e x = createSFR "bessel_j0_e" $ gsl_sf_bessel_j0_e x
-foreign import ccall "gsl_sf_bessel_j0_e" gsl_sf_bessel_j0_e :: Double -> Ptr () -> IO CInt
-
-bessel_j0 :: Double -> Double
-bessel_j0 = gsl_sf_bessel_j0
-foreign import ccall "gsl_sf_bessel_j0" gsl_sf_bessel_j0 :: Double -> Double
-
-bessel_j1_e :: Double -> (Double,Double)
-bessel_j1_e x = createSFR "bessel_j1_e" $ gsl_sf_bessel_j1_e x
-foreign import ccall "gsl_sf_bessel_j1_e" gsl_sf_bessel_j1_e :: Double -> Ptr () -> IO CInt
-
-bessel_j1 :: Double -> Double
-bessel_j1 = gsl_sf_bessel_j1
-foreign import ccall "gsl_sf_bessel_j1" gsl_sf_bessel_j1 :: Double -> Double
-
-bessel_j2_e :: Double -> (Double,Double)
-bessel_j2_e x = createSFR "bessel_j2_e" $ gsl_sf_bessel_j2_e x
-foreign import ccall "gsl_sf_bessel_j2_e" gsl_sf_bessel_j2_e :: Double -> Ptr () -> IO CInt
-
-bessel_j2 :: Double -> Double
-bessel_j2 = gsl_sf_bessel_j2
-foreign import ccall "gsl_sf_bessel_j2" gsl_sf_bessel_j2 :: Double -> Double
-
-bessel_jl_e :: CInt -> Double -> (Double,Double)
-bessel_jl_e l x = createSFR "bessel_jl_e" $ gsl_sf_bessel_jl_e l x
-foreign import ccall "gsl_sf_bessel_jl_e" gsl_sf_bessel_jl_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_jl :: CInt -> Double -> Double
-bessel_jl = gsl_sf_bessel_jl
-foreign import ccall "gsl_sf_bessel_jl" gsl_sf_bessel_jl :: CInt -> Double -> Double
-
-bessel_jl_array :: CInt -> Double -> Ptr Double -> CInt
-bessel_jl_array = gsl_sf_bessel_jl_array
-foreign import ccall "gsl_sf_bessel_jl_array" gsl_sf_bessel_jl_array :: CInt -> Double -> Ptr Double -> CInt
-
-bessel_jl_steed_array :: CInt -> Double -> Ptr Double -> CInt
-bessel_jl_steed_array = gsl_sf_bessel_jl_steed_array
-foreign import ccall "gsl_sf_bessel_jl_steed_array" gsl_sf_bessel_jl_steed_array :: CInt -> Double -> Ptr Double -> CInt
-
-bessel_y0_e :: Double -> (Double,Double)
-bessel_y0_e x = createSFR "bessel_y0_e" $ gsl_sf_bessel_y0_e x
-foreign import ccall "gsl_sf_bessel_y0_e" gsl_sf_bessel_y0_e :: Double -> Ptr () -> IO CInt
-
-bessel_y0 :: Double -> Double
-bessel_y0 = gsl_sf_bessel_y0
-foreign import ccall "gsl_sf_bessel_y0" gsl_sf_bessel_y0 :: Double -> Double
-
-bessel_y1_e :: Double -> (Double,Double)
-bessel_y1_e x = createSFR "bessel_y1_e" $ gsl_sf_bessel_y1_e x
-foreign import ccall "gsl_sf_bessel_y1_e" gsl_sf_bessel_y1_e :: Double -> Ptr () -> IO CInt
-
-bessel_y1 :: Double -> Double
-bessel_y1 = gsl_sf_bessel_y1
-foreign import ccall "gsl_sf_bessel_y1" gsl_sf_bessel_y1 :: Double -> Double
-
-bessel_y2_e :: Double -> (Double,Double)
-bessel_y2_e x = createSFR "bessel_y2_e" $ gsl_sf_bessel_y2_e x
-foreign import ccall "gsl_sf_bessel_y2_e" gsl_sf_bessel_y2_e :: Double -> Ptr () -> IO CInt
-
-bessel_y2 :: Double -> Double
-bessel_y2 = gsl_sf_bessel_y2
-foreign import ccall "gsl_sf_bessel_y2" gsl_sf_bessel_y2 :: Double -> Double
-
-bessel_yl_e :: CInt -> Double -> (Double,Double)
-bessel_yl_e l x = createSFR "bessel_yl_e" $ gsl_sf_bessel_yl_e l x
-foreign import ccall "gsl_sf_bessel_yl_e" gsl_sf_bessel_yl_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_yl :: CInt -> Double -> Double
-bessel_yl = gsl_sf_bessel_yl
-foreign import ccall "gsl_sf_bessel_yl" gsl_sf_bessel_yl :: CInt -> Double -> Double
-
-bessel_yl_array :: CInt -> Double -> Ptr Double -> CInt
-bessel_yl_array = gsl_sf_bessel_yl_array
-foreign import ccall "gsl_sf_bessel_yl_array" gsl_sf_bessel_yl_array :: CInt -> Double -> Ptr Double -> CInt
-
-bessel_i0_scaled_e :: Double -> (Double,Double)
-bessel_i0_scaled_e x = createSFR "bessel_i0_scaled_e" $ gsl_sf_bessel_i0_scaled_e x
-foreign import ccall "gsl_sf_bessel_i0_scaled_e" gsl_sf_bessel_i0_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_i0_scaled :: Double -> Double
-bessel_i0_scaled = gsl_sf_bessel_i0_scaled
-foreign import ccall "gsl_sf_bessel_i0_scaled" gsl_sf_bessel_i0_scaled :: Double -> Double
-
-bessel_i1_scaled_e :: Double -> (Double,Double)
-bessel_i1_scaled_e x = createSFR "bessel_i1_scaled_e" $ gsl_sf_bessel_i1_scaled_e x
-foreign import ccall "gsl_sf_bessel_i1_scaled_e" gsl_sf_bessel_i1_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_i1_scaled :: Double -> Double
-bessel_i1_scaled = gsl_sf_bessel_i1_scaled
-foreign import ccall "gsl_sf_bessel_i1_scaled" gsl_sf_bessel_i1_scaled :: Double -> Double
-
-bessel_i2_scaled_e :: Double -> (Double,Double)
-bessel_i2_scaled_e x = createSFR "bessel_i2_scaled_e" $ gsl_sf_bessel_i2_scaled_e x
-foreign import ccall "gsl_sf_bessel_i2_scaled_e" gsl_sf_bessel_i2_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_i2_scaled :: Double -> Double
-bessel_i2_scaled = gsl_sf_bessel_i2_scaled
-foreign import ccall "gsl_sf_bessel_i2_scaled" gsl_sf_bessel_i2_scaled :: Double -> Double
-
-bessel_il_scaled_e :: CInt -> Double -> (Double,Double)
-bessel_il_scaled_e l x = createSFR "bessel_il_scaled_e" $ gsl_sf_bessel_il_scaled_e l x
-foreign import ccall "gsl_sf_bessel_il_scaled_e" gsl_sf_bessel_il_scaled_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_il_scaled :: CInt -> Double -> Double
-bessel_il_scaled = gsl_sf_bessel_il_scaled
-foreign import ccall "gsl_sf_bessel_il_scaled" gsl_sf_bessel_il_scaled :: CInt -> Double -> Double
-
-bessel_il_scaled_array :: CInt -> Double -> Ptr Double -> CInt
-bessel_il_scaled_array = gsl_sf_bessel_il_scaled_array
-foreign import ccall "gsl_sf_bessel_il_scaled_array" gsl_sf_bessel_il_scaled_array :: CInt -> Double -> Ptr Double -> CInt
-
-bessel_k0_scaled_e :: Double -> (Double,Double)
-bessel_k0_scaled_e x = createSFR "bessel_k0_scaled_e" $ gsl_sf_bessel_k0_scaled_e x
-foreign import ccall "gsl_sf_bessel_k0_scaled_e" gsl_sf_bessel_k0_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_k0_scaled :: Double -> Double
-bessel_k0_scaled = gsl_sf_bessel_k0_scaled
-foreign import ccall "gsl_sf_bessel_k0_scaled" gsl_sf_bessel_k0_scaled :: Double -> Double
-
-bessel_k1_scaled_e :: Double -> (Double,Double)
-bessel_k1_scaled_e x = createSFR "bessel_k1_scaled_e" $ gsl_sf_bessel_k1_scaled_e x
-foreign import ccall "gsl_sf_bessel_k1_scaled_e" gsl_sf_bessel_k1_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_k1_scaled :: Double -> Double
-bessel_k1_scaled = gsl_sf_bessel_k1_scaled
-foreign import ccall "gsl_sf_bessel_k1_scaled" gsl_sf_bessel_k1_scaled :: Double -> Double
-
-bessel_k2_scaled_e :: Double -> (Double,Double)
-bessel_k2_scaled_e x = createSFR "bessel_k2_scaled_e" $ gsl_sf_bessel_k2_scaled_e x
-foreign import ccall "gsl_sf_bessel_k2_scaled_e" gsl_sf_bessel_k2_scaled_e :: Double -> Ptr () -> IO CInt
-
-bessel_k2_scaled :: Double -> Double
-bessel_k2_scaled = gsl_sf_bessel_k2_scaled
-foreign import ccall "gsl_sf_bessel_k2_scaled" gsl_sf_bessel_k2_scaled :: Double -> Double
-
-bessel_kl_scaled_e :: CInt -> Double -> (Double,Double)
-bessel_kl_scaled_e l x = createSFR "bessel_kl_scaled_e" $ gsl_sf_bessel_kl_scaled_e l x
-foreign import ccall "gsl_sf_bessel_kl_scaled_e" gsl_sf_bessel_kl_scaled_e :: CInt -> Double -> Ptr () -> IO CInt
-
-bessel_kl_scaled :: CInt -> Double -> Double
-bessel_kl_scaled = gsl_sf_bessel_kl_scaled
-foreign import ccall "gsl_sf_bessel_kl_scaled" gsl_sf_bessel_kl_scaled :: CInt -> Double -> Double
-
-bessel_kl_scaled_array :: CInt -> Double -> Ptr Double -> CInt
-bessel_kl_scaled_array = gsl_sf_bessel_kl_scaled_array
-foreign import ccall "gsl_sf_bessel_kl_scaled_array" gsl_sf_bessel_kl_scaled_array :: CInt -> Double -> Ptr Double -> CInt
-
-bessel_Jnu_e :: Double -> Double -> (Double,Double)
-bessel_Jnu_e nu x = createSFR "bessel_Jnu_e" $ gsl_sf_bessel_Jnu_e nu x
-foreign import ccall "gsl_sf_bessel_Jnu_e" gsl_sf_bessel_Jnu_e :: Double -> Double -> Ptr () -> IO CInt
-
-bessel_Jnu :: Double -> Double -> Double
-bessel_Jnu = gsl_sf_bessel_Jnu
-foreign import ccall "gsl_sf_bessel_Jnu" gsl_sf_bessel_Jnu :: Double -> Double -> Double
-
-bessel_Ynu_e :: Double -> Double -> (Double,Double)
-bessel_Ynu_e nu x = createSFR "bessel_Ynu_e" $ gsl_sf_bessel_Ynu_e nu x
-foreign import ccall "gsl_sf_bessel_Ynu_e" gsl_sf_bessel_Ynu_e :: Double -> Double -> Ptr () -> IO CInt
-
-bessel_Ynu :: Double -> Double -> Double
-bessel_Ynu = gsl_sf_bessel_Ynu
-foreign import ccall "gsl_sf_bessel_Ynu" gsl_sf_bessel_Ynu :: Double -> Double -> Double
-
-bessel_sequence_Jnu_e :: Double -> Precision -> Size_t -> Ptr Double -> CInt
-bessel_sequence_Jnu_e nu mode size v = gsl_sf_bessel_sequence_Jnu_e nu  (precCode mode) size v
-foreign import ccall "gsl_sf_bessel_sequence_Jnu_e" gsl_sf_bessel_sequence_Jnu_e :: Double -> Gsl_mode_t -> Size_t -> Ptr Double -> CInt
-
-bessel_Inu_scaled_e :: Double -> Double -> (Double,Double)
-bessel_Inu_scaled_e nu x = createSFR "bessel_Inu_scaled_e" $ gsl_sf_bessel_Inu_scaled_e nu x
-foreign import ccall "gsl_sf_bessel_Inu_scaled_e" gsl_sf_bessel_Inu_scaled_e :: Double -> Double -> Ptr () -> IO CInt
-
-bessel_Inu_scaled :: Double -> Double -> Double
-bessel_Inu_scaled = gsl_sf_bessel_Inu_scaled
-foreign import ccall "gsl_sf_bessel_Inu_scaled" gsl_sf_bessel_Inu_scaled :: Double -> Double -> Double
-
-bessel_Inu_e :: Double -> Double -> (Double,Double)
-bessel_Inu_e nu x = createSFR "bessel_Inu_e" $ gsl_sf_bessel_Inu_e nu x
-foreign import ccall "gsl_sf_bessel_Inu_e" gsl_sf_bessel_Inu_e :: Double -> Double -> Ptr () -> IO CInt
-
-bessel_Inu :: Double -> Double -> Double
-bessel_Inu = gsl_sf_bessel_Inu
-foreign import ccall "gsl_sf_bessel_Inu" gsl_sf_bessel_Inu :: Double -> Double -> Double
-
-bessel_Knu_scaled_e :: Double -> Double -> (Double,Double)
-bessel_Knu_scaled_e nu x = createSFR "bessel_Knu_scaled_e" $ gsl_sf_bessel_Knu_scaled_e nu x
-foreign import ccall "gsl_sf_bessel_Knu_scaled_e" gsl_sf_bessel_Knu_scaled_e :: Double -> Double -> Ptr () -> IO CInt
-
-bessel_Knu_scaled :: Double -> Double -> Double
-bessel_Knu_scaled = gsl_sf_bessel_Knu_scaled
-foreign import ccall "gsl_sf_bessel_Knu_scaled" gsl_sf_bessel_Knu_scaled :: Double -> Double -> Double
-
-bessel_Knu_e :: Double -> Double -> (Double,Double)
-bessel_Knu_e nu x = createSFR "bessel_Knu_e" $ gsl_sf_bessel_Knu_e nu x
-foreign import ccall "gsl_sf_bessel_Knu_e" gsl_sf_bessel_Knu_e :: Double -> Double -> Ptr () -> IO CInt
-
-bessel_Knu :: Double -> Double -> Double
-bessel_Knu = gsl_sf_bessel_Knu
-foreign import ccall "gsl_sf_bessel_Knu" gsl_sf_bessel_Knu :: Double -> Double -> Double
-
-bessel_lnKnu_e :: Double -> Double -> (Double,Double)
-bessel_lnKnu_e nu x = createSFR "bessel_lnKnu_e" $ gsl_sf_bessel_lnKnu_e nu x
-foreign import ccall "gsl_sf_bessel_lnKnu_e" gsl_sf_bessel_lnKnu_e :: Double -> Double -> Ptr () -> IO CInt
-
-bessel_lnKnu :: Double -> Double -> Double
-bessel_lnKnu = gsl_sf_bessel_lnKnu
-foreign import ccall "gsl_sf_bessel_lnKnu" gsl_sf_bessel_lnKnu :: Double -> Double -> Double
-
-bessel_zero_J0_e :: CInt -> (Double,Double)
-bessel_zero_J0_e s = createSFR "bessel_zero_J0_e" $ gsl_sf_bessel_zero_J0_e s
-foreign import ccall "gsl_sf_bessel_zero_J0_e" gsl_sf_bessel_zero_J0_e :: CInt -> Ptr () -> IO CInt
-
-bessel_zero_J0 :: CInt -> Double
-bessel_zero_J0 = gsl_sf_bessel_zero_J0
-foreign import ccall "gsl_sf_bessel_zero_J0" gsl_sf_bessel_zero_J0 :: CInt -> Double
-
-bessel_zero_J1_e :: CInt -> (Double,Double)
-bessel_zero_J1_e s = createSFR "bessel_zero_J1_e" $ gsl_sf_bessel_zero_J1_e s
-foreign import ccall "gsl_sf_bessel_zero_J1_e" gsl_sf_bessel_zero_J1_e :: CInt -> Ptr () -> IO CInt
-
-bessel_zero_J1 :: CInt -> Double
-bessel_zero_J1 = gsl_sf_bessel_zero_J1
-foreign import ccall "gsl_sf_bessel_zero_J1" gsl_sf_bessel_zero_J1 :: CInt -> Double
-
-bessel_zero_Jnu_e :: Double -> CInt -> (Double,Double)
-bessel_zero_Jnu_e nu s = createSFR "bessel_zero_Jnu_e" $ gsl_sf_bessel_zero_Jnu_e nu s
-foreign import ccall "gsl_sf_bessel_zero_Jnu_e" gsl_sf_bessel_zero_Jnu_e :: Double -> CInt -> Ptr () -> IO CInt
-
-bessel_zero_Jnu :: Double -> CInt -> Double
-bessel_zero_Jnu = gsl_sf_bessel_zero_Jnu
-foreign import ccall "gsl_sf_bessel_zero_Jnu" gsl_sf_bessel_zero_Jnu :: Double -> CInt -> Double
diff --git a/lib/Numeric/GSL/Special/Clausen.hs b/lib/Numeric/GSL/Special/Clausen.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Clausen.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Clausen
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_clausen.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Clausen(
-  clausen_e
-, clausen
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-clausen_e :: Double -> (Double,Double)
-clausen_e x = createSFR "clausen_e" $ gsl_sf_clausen_e x
-foreign import ccall "gsl_sf_clausen_e" gsl_sf_clausen_e :: Double -> Ptr () -> IO CInt
-
-clausen :: Double -> Double
-clausen = gsl_sf_clausen
-foreign import ccall "gsl_sf_clausen" gsl_sf_clausen :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Coulomb.hs b/lib/Numeric/GSL/Special/Coulomb.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Coulomb.hs
+++ /dev/null
@@ -1,69 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Coulomb
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_coulomb.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Coulomb(
-  hydrogenicR_1_e
-, hydrogenicR_1
-, hydrogenicR_e
-, hydrogenicR
-, coulomb_CL_e
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-hydrogenicR_1_e :: Double -> Double -> (Double,Double)
-hydrogenicR_1_e zZ r = createSFR "hydrogenicR_1_e" $ gsl_sf_hydrogenicR_1_e zZ r
-foreign import ccall "gsl_sf_hydrogenicR_1_e" gsl_sf_hydrogenicR_1_e :: Double -> Double -> Ptr () -> IO CInt
-
-hydrogenicR_1 :: Double -> Double -> Double
-hydrogenicR_1 = gsl_sf_hydrogenicR_1
-foreign import ccall "gsl_sf_hydrogenicR_1" gsl_sf_hydrogenicR_1 :: Double -> Double -> Double
-
-hydrogenicR_e :: CInt -> CInt -> Double -> Double -> (Double,Double)
-hydrogenicR_e n l zZ r = createSFR "hydrogenicR_e" $ gsl_sf_hydrogenicR_e n l zZ r
-foreign import ccall "gsl_sf_hydrogenicR_e" gsl_sf_hydrogenicR_e :: CInt -> CInt -> Double -> Double -> Ptr () -> IO CInt
-
-hydrogenicR :: CInt -> CInt -> Double -> Double -> Double
-hydrogenicR = gsl_sf_hydrogenicR
-foreign import ccall "gsl_sf_hydrogenicR" gsl_sf_hydrogenicR :: CInt -> CInt -> Double -> Double -> Double
-
-coulomb_wave_FG_e :: Double -> Double -> Double -> CInt -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> Ptr Double -> Ptr Double -> CInt
-coulomb_wave_FG_e = gsl_sf_coulomb_wave_FG_e
-foreign import ccall "gsl_sf_coulomb_wave_FG_e" gsl_sf_coulomb_wave_FG_e :: Double -> Double -> Double -> CInt -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> Ptr Double -> Ptr Double -> CInt
-
-coulomb_wave_F_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> CInt
-coulomb_wave_F_array = gsl_sf_coulomb_wave_F_array
-foreign import ccall "gsl_sf_coulomb_wave_F_array" gsl_sf_coulomb_wave_F_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> CInt
-
-coulomb_wave_FG_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> CInt
-coulomb_wave_FG_array = gsl_sf_coulomb_wave_FG_array
-foreign import ccall "gsl_sf_coulomb_wave_FG_array" gsl_sf_coulomb_wave_FG_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> CInt
-
-coulomb_wave_FGp_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> CInt
-coulomb_wave_FGp_array = gsl_sf_coulomb_wave_FGp_array
-foreign import ccall "gsl_sf_coulomb_wave_FGp_array" gsl_sf_coulomb_wave_FGp_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> Ptr Double -> CInt
-
-coulomb_wave_sphF_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> CInt
-coulomb_wave_sphF_array = gsl_sf_coulomb_wave_sphF_array
-foreign import ccall "gsl_sf_coulomb_wave_sphF_array" gsl_sf_coulomb_wave_sphF_array :: Double -> CInt -> Double -> Double -> Ptr Double -> Ptr Double -> CInt
-
-coulomb_CL_e :: Double -> Double -> (Double,Double)
-coulomb_CL_e lL eta = createSFR "coulomb_CL_e" $ gsl_sf_coulomb_CL_e lL eta
-foreign import ccall "gsl_sf_coulomb_CL_e" gsl_sf_coulomb_CL_e :: Double -> Double -> Ptr () -> IO CInt
-
-coulomb_CL_array :: Double -> CInt -> Double -> Ptr Double -> CInt
-coulomb_CL_array = gsl_sf_coulomb_CL_array
-foreign import ccall "gsl_sf_coulomb_CL_array" gsl_sf_coulomb_CL_array :: Double -> CInt -> Double -> Ptr Double -> CInt
diff --git a/lib/Numeric/GSL/Special/Coupling.hs b/lib/Numeric/GSL/Special/Coupling.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Coupling.hs
+++ /dev/null
@@ -1,68 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Coupling
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_coupling.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Coupling(
-  coupling_3j_e
-, coupling_3j
-, coupling_6j_e
-, coupling_6j
-, coupling_RacahW_e
-, coupling_RacahW
-, coupling_9j_e
-, coupling_9j
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-coupling_3j_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> (Double,Double)
-coupling_3j_e two_ja two_jb two_jc two_ma two_mb two_mc = createSFR "coupling_3j_e" $ gsl_sf_coupling_3j_e two_ja two_jb two_jc two_ma two_mb two_mc
-foreign import ccall "gsl_sf_coupling_3j_e" gsl_sf_coupling_3j_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Ptr () -> IO CInt
-
-coupling_3j :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-coupling_3j = gsl_sf_coupling_3j
-foreign import ccall "gsl_sf_coupling_3j" gsl_sf_coupling_3j :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-
-coupling_6j_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> (Double,Double)
-coupling_6j_e two_ja two_jb two_jc two_jd two_je two_jf = createSFR "coupling_6j_e" $ gsl_sf_coupling_6j_e two_ja two_jb two_jc two_jd two_je two_jf
-foreign import ccall "gsl_sf_coupling_6j_e" gsl_sf_coupling_6j_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Ptr () -> IO CInt
-
-coupling_6j :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-coupling_6j = gsl_sf_coupling_6j
-foreign import ccall "gsl_sf_coupling_6j" gsl_sf_coupling_6j :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-
-coupling_RacahW_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> (Double,Double)
-coupling_RacahW_e two_ja two_jb two_jc two_jd two_je two_jf = createSFR "coupling_RacahW_e" $ gsl_sf_coupling_RacahW_e two_ja two_jb two_jc two_jd two_je two_jf
-foreign import ccall "gsl_sf_coupling_RacahW_e" gsl_sf_coupling_RacahW_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Ptr () -> IO CInt
-
-coupling_RacahW :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-coupling_RacahW = gsl_sf_coupling_RacahW
-foreign import ccall "gsl_sf_coupling_RacahW" gsl_sf_coupling_RacahW :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-
-coupling_9j_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> (Double,Double)
-coupling_9j_e two_ja two_jb two_jc two_jd two_je two_jf two_jg two_jh two_ji = createSFR "coupling_9j_e" $ gsl_sf_coupling_9j_e two_ja two_jb two_jc two_jd two_je two_jf two_jg two_jh two_ji
-foreign import ccall "gsl_sf_coupling_9j_e" gsl_sf_coupling_9j_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Ptr () -> IO CInt
-
-coupling_9j :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-coupling_9j = gsl_sf_coupling_9j
-foreign import ccall "gsl_sf_coupling_9j" gsl_sf_coupling_9j :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-
-coupling_6j_INCORRECT_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> (Double,Double)
-coupling_6j_INCORRECT_e two_ja two_jb two_jc two_jd two_je two_jf = createSFR "coupling_6j_INCORRECT_e" $ gsl_sf_coupling_6j_INCORRECT_e two_ja two_jb two_jc two_jd two_je two_jf
-foreign import ccall "gsl_sf_coupling_6j_INCORRECT_e" gsl_sf_coupling_6j_INCORRECT_e :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Ptr () -> IO CInt
-
-coupling_6j_INCORRECT :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
-coupling_6j_INCORRECT = gsl_sf_coupling_6j_INCORRECT
-foreign import ccall "gsl_sf_coupling_6j_INCORRECT" gsl_sf_coupling_6j_INCORRECT :: CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> Double
diff --git a/lib/Numeric/GSL/Special/Dawson.hs b/lib/Numeric/GSL/Special/Dawson.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Dawson.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Dawson
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_dawson.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Dawson(
-  dawson_e
-, dawson
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-dawson_e :: Double -> (Double,Double)
-dawson_e x = createSFR "dawson_e" $ gsl_sf_dawson_e x
-foreign import ccall "gsl_sf_dawson_e" gsl_sf_dawson_e :: Double -> Ptr () -> IO CInt
-
-dawson :: Double -> Double
-dawson = gsl_sf_dawson
-foreign import ccall "gsl_sf_dawson" gsl_sf_dawson :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Debye.hs b/lib/Numeric/GSL/Special/Debye.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Debye.hs
+++ /dev/null
@@ -1,80 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Debye
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_debye.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Debye(
-  debye_1_e
-, debye_1
-, debye_2_e
-, debye_2
-, debye_3_e
-, debye_3
-, debye_4_e
-, debye_4
-, debye_5_e
-, debye_5
-, debye_6_e
-, debye_6
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-debye_1_e :: Double -> (Double,Double)
-debye_1_e x = createSFR "debye_1_e" $ gsl_sf_debye_1_e x
-foreign import ccall "gsl_sf_debye_1_e" gsl_sf_debye_1_e :: Double -> Ptr () -> IO CInt
-
-debye_1 :: Double -> Double
-debye_1 = gsl_sf_debye_1
-foreign import ccall "gsl_sf_debye_1" gsl_sf_debye_1 :: Double -> Double
-
-debye_2_e :: Double -> (Double,Double)
-debye_2_e x = createSFR "debye_2_e" $ gsl_sf_debye_2_e x
-foreign import ccall "gsl_sf_debye_2_e" gsl_sf_debye_2_e :: Double -> Ptr () -> IO CInt
-
-debye_2 :: Double -> Double
-debye_2 = gsl_sf_debye_2
-foreign import ccall "gsl_sf_debye_2" gsl_sf_debye_2 :: Double -> Double
-
-debye_3_e :: Double -> (Double,Double)
-debye_3_e x = createSFR "debye_3_e" $ gsl_sf_debye_3_e x
-foreign import ccall "gsl_sf_debye_3_e" gsl_sf_debye_3_e :: Double -> Ptr () -> IO CInt
-
-debye_3 :: Double -> Double
-debye_3 = gsl_sf_debye_3
-foreign import ccall "gsl_sf_debye_3" gsl_sf_debye_3 :: Double -> Double
-
-debye_4_e :: Double -> (Double,Double)
-debye_4_e x = createSFR "debye_4_e" $ gsl_sf_debye_4_e x
-foreign import ccall "gsl_sf_debye_4_e" gsl_sf_debye_4_e :: Double -> Ptr () -> IO CInt
-
-debye_4 :: Double -> Double
-debye_4 = gsl_sf_debye_4
-foreign import ccall "gsl_sf_debye_4" gsl_sf_debye_4 :: Double -> Double
-
-debye_5_e :: Double -> (Double,Double)
-debye_5_e x = createSFR "debye_5_e" $ gsl_sf_debye_5_e x
-foreign import ccall "gsl_sf_debye_5_e" gsl_sf_debye_5_e :: Double -> Ptr () -> IO CInt
-
-debye_5 :: Double -> Double
-debye_5 = gsl_sf_debye_5
-foreign import ccall "gsl_sf_debye_5" gsl_sf_debye_5 :: Double -> Double
-
-debye_6_e :: Double -> (Double,Double)
-debye_6_e x = createSFR "debye_6_e" $ gsl_sf_debye_6_e x
-foreign import ccall "gsl_sf_debye_6_e" gsl_sf_debye_6_e :: Double -> Ptr () -> IO CInt
-
-debye_6 :: Double -> Double
-debye_6 = gsl_sf_debye_6
-foreign import ccall "gsl_sf_debye_6" gsl_sf_debye_6 :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Dilog.hs b/lib/Numeric/GSL/Special/Dilog.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Dilog.hs
+++ /dev/null
@@ -1,42 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Dilog
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_dilog.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Dilog(
-  dilog_e
-, dilog
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-dilog_e :: Double -> (Double,Double)
-dilog_e x = createSFR "dilog_e" $ gsl_sf_dilog_e x
-foreign import ccall "gsl_sf_dilog_e" gsl_sf_dilog_e :: Double -> Ptr () -> IO CInt
-
-dilog :: Double -> Double
-dilog = gsl_sf_dilog
-foreign import ccall "gsl_sf_dilog" gsl_sf_dilog :: Double -> Double
-
-complex_dilog_xy_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_dilog_xy_e x y result_re = createSFR "complex_dilog_xy_e" $ gsl_sf_complex_dilog_xy_e x y result_re
-foreign import ccall "gsl_sf_complex_dilog_xy_e" gsl_sf_complex_dilog_xy_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-complex_dilog_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_dilog_e r theta result_re = createSFR "complex_dilog_e" $ gsl_sf_complex_dilog_e r theta result_re
-foreign import ccall "gsl_sf_complex_dilog_e" gsl_sf_complex_dilog_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-complex_spence_xy_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_spence_xy_e x y real_sp = createSFR "complex_spence_xy_e" $ gsl_sf_complex_spence_xy_e x y real_sp
-foreign import ccall "gsl_sf_complex_spence_xy_e" gsl_sf_complex_spence_xy_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
diff --git a/lib/Numeric/GSL/Special/Elementary.hs b/lib/Numeric/GSL/Special/Elementary.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Elementary.hs
+++ /dev/null
@@ -1,35 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Elementary
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_elementary.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Elementary(
-  multiply_e
-, multiply
-, multiply_err_e
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-multiply_e :: Double -> Double -> (Double,Double)
-multiply_e x y = createSFR "multiply_e" $ gsl_sf_multiply_e x y
-foreign import ccall "gsl_sf_multiply_e" gsl_sf_multiply_e :: Double -> Double -> Ptr () -> IO CInt
-
-multiply :: Double -> Double -> Double
-multiply = gsl_sf_multiply
-foreign import ccall "gsl_sf_multiply" gsl_sf_multiply :: Double -> Double -> Double
-
-multiply_err_e :: Double -> Double -> Double -> Double -> (Double,Double)
-multiply_err_e x dx y dy = createSFR "multiply_err_e" $ gsl_sf_multiply_err_e x dx y dy
-foreign import ccall "gsl_sf_multiply_err_e" gsl_sf_multiply_err_e :: Double -> Double -> Double -> Double -> Ptr () -> IO CInt
diff --git a/lib/Numeric/GSL/Special/Ellint.hs b/lib/Numeric/GSL/Special/Ellint.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Ellint.hs
+++ /dev/null
@@ -1,140 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Ellint
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_ellint.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Ellint(
-  ellint_Kcomp_e
-, ellint_Kcomp
-, ellint_Ecomp_e
-, ellint_Ecomp
-, ellint_Pcomp_e
-, ellint_Pcomp
-, ellint_Dcomp_e
-, ellint_Dcomp
-, ellint_F_e
-, ellint_F
-, ellint_E_e
-, ellint_E
-, ellint_P_e
-, ellint_P
-, ellint_D_e
-, ellint_D
-, ellint_RC_e
-, ellint_RC
-, ellint_RD_e
-, ellint_RD
-, ellint_RF_e
-, ellint_RF
-, ellint_RJ_e
-, ellint_RJ
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-ellint_Kcomp_e :: Double -> Precision -> (Double,Double)
-ellint_Kcomp_e k mode = createSFR "ellint_Kcomp_e" $ gsl_sf_ellint_Kcomp_e k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Kcomp_e" gsl_sf_ellint_Kcomp_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_Kcomp :: Double -> Precision -> Double
-ellint_Kcomp k mode = gsl_sf_ellint_Kcomp k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Kcomp" gsl_sf_ellint_Kcomp :: Double -> Gsl_mode_t -> Double
-
-ellint_Ecomp_e :: Double -> Precision -> (Double,Double)
-ellint_Ecomp_e k mode = createSFR "ellint_Ecomp_e" $ gsl_sf_ellint_Ecomp_e k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Ecomp_e" gsl_sf_ellint_Ecomp_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_Ecomp :: Double -> Precision -> Double
-ellint_Ecomp k mode = gsl_sf_ellint_Ecomp k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Ecomp" gsl_sf_ellint_Ecomp :: Double -> Gsl_mode_t -> Double
-
-ellint_Pcomp_e :: Double -> Double -> Precision -> (Double,Double)
-ellint_Pcomp_e k n mode = createSFR "ellint_Pcomp_e" $ gsl_sf_ellint_Pcomp_e k n  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Pcomp_e" gsl_sf_ellint_Pcomp_e :: Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_Pcomp :: Double -> Double -> Precision -> Double
-ellint_Pcomp k n mode = gsl_sf_ellint_Pcomp k n  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Pcomp" gsl_sf_ellint_Pcomp :: Double -> Double -> Gsl_mode_t -> Double
-
-ellint_Dcomp_e :: Double -> Precision -> (Double,Double)
-ellint_Dcomp_e k mode = createSFR "ellint_Dcomp_e" $ gsl_sf_ellint_Dcomp_e k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Dcomp_e" gsl_sf_ellint_Dcomp_e :: Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_Dcomp :: Double -> Precision -> Double
-ellint_Dcomp k mode = gsl_sf_ellint_Dcomp k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_Dcomp" gsl_sf_ellint_Dcomp :: Double -> Gsl_mode_t -> Double
-
-ellint_F_e :: Double -> Double -> Precision -> (Double,Double)
-ellint_F_e phi k mode = createSFR "ellint_F_e" $ gsl_sf_ellint_F_e phi k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_F_e" gsl_sf_ellint_F_e :: Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_F :: Double -> Double -> Precision -> Double
-ellint_F phi k mode = gsl_sf_ellint_F phi k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_F" gsl_sf_ellint_F :: Double -> Double -> Gsl_mode_t -> Double
-
-ellint_E_e :: Double -> Double -> Precision -> (Double,Double)
-ellint_E_e phi k mode = createSFR "ellint_E_e" $ gsl_sf_ellint_E_e phi k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_E_e" gsl_sf_ellint_E_e :: Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_E :: Double -> Double -> Precision -> Double
-ellint_E phi k mode = gsl_sf_ellint_E phi k  (precCode mode)
-foreign import ccall "gsl_sf_ellint_E" gsl_sf_ellint_E :: Double -> Double -> Gsl_mode_t -> Double
-
-ellint_P_e :: Double -> Double -> Double -> Precision -> (Double,Double)
-ellint_P_e phi k n mode = createSFR "ellint_P_e" $ gsl_sf_ellint_P_e phi k n  (precCode mode)
-foreign import ccall "gsl_sf_ellint_P_e" gsl_sf_ellint_P_e :: Double -> Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_P :: Double -> Double -> Double -> Precision -> Double
-ellint_P phi k n mode = gsl_sf_ellint_P phi k n  (precCode mode)
-foreign import ccall "gsl_sf_ellint_P" gsl_sf_ellint_P :: Double -> Double -> Double -> Gsl_mode_t -> Double
-
-ellint_D_e :: Double -> Double -> Double -> Precision -> (Double,Double)
-ellint_D_e phi k n mode = createSFR "ellint_D_e" $ gsl_sf_ellint_D_e phi k n  (precCode mode)
-foreign import ccall "gsl_sf_ellint_D_e" gsl_sf_ellint_D_e :: Double -> Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_D :: Double -> Double -> Double -> Precision -> Double
-ellint_D phi k n mode = gsl_sf_ellint_D phi k n  (precCode mode)
-foreign import ccall "gsl_sf_ellint_D" gsl_sf_ellint_D :: Double -> Double -> Double -> Gsl_mode_t -> Double
-
-ellint_RC_e :: Double -> Double -> Precision -> (Double,Double)
-ellint_RC_e x y mode = createSFR "ellint_RC_e" $ gsl_sf_ellint_RC_e x y  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RC_e" gsl_sf_ellint_RC_e :: Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_RC :: Double -> Double -> Precision -> Double
-ellint_RC x y mode = gsl_sf_ellint_RC x y  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RC" gsl_sf_ellint_RC :: Double -> Double -> Gsl_mode_t -> Double
-
-ellint_RD_e :: Double -> Double -> Double -> Precision -> (Double,Double)
-ellint_RD_e x y z mode = createSFR "ellint_RD_e" $ gsl_sf_ellint_RD_e x y z  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RD_e" gsl_sf_ellint_RD_e :: Double -> Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_RD :: Double -> Double -> Double -> Precision -> Double
-ellint_RD x y z mode = gsl_sf_ellint_RD x y z  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RD" gsl_sf_ellint_RD :: Double -> Double -> Double -> Gsl_mode_t -> Double
-
-ellint_RF_e :: Double -> Double -> Double -> Precision -> (Double,Double)
-ellint_RF_e x y z mode = createSFR "ellint_RF_e" $ gsl_sf_ellint_RF_e x y z  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RF_e" gsl_sf_ellint_RF_e :: Double -> Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_RF :: Double -> Double -> Double -> Precision -> Double
-ellint_RF x y z mode = gsl_sf_ellint_RF x y z  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RF" gsl_sf_ellint_RF :: Double -> Double -> Double -> Gsl_mode_t -> Double
-
-ellint_RJ_e :: Double -> Double -> Double -> Double -> Precision -> (Double,Double)
-ellint_RJ_e x y z p mode = createSFR "ellint_RJ_e" $ gsl_sf_ellint_RJ_e x y z p  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RJ_e" gsl_sf_ellint_RJ_e :: Double -> Double -> Double -> Double -> Gsl_mode_t -> Ptr () -> IO CInt
-
-ellint_RJ :: Double -> Double -> Double -> Double -> Precision -> Double
-ellint_RJ x y z p mode = gsl_sf_ellint_RJ x y z p  (precCode mode)
-foreign import ccall "gsl_sf_ellint_RJ" gsl_sf_ellint_RJ :: Double -> Double -> Double -> Double -> Gsl_mode_t -> Double
diff --git a/lib/Numeric/GSL/Special/Elljac.hs b/lib/Numeric/GSL/Special/Elljac.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Elljac.hs
+++ /dev/null
@@ -1,38 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Elljac
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_elljac.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Elljac(
-elljac_e
-) where
-
-import Foreign
-import Foreign.C.Types(CInt)
-
-elljac_e :: Double -> Double -> (Double,Double,Double)
-elljac_e u m = unsafePerformIO $ do
-    psn <- malloc
-    pcn <- malloc
-    pdn <- malloc
-    res <- gsl_sf_elljac_e u m psn pcn pdn
-    sn <- peek psn
-    cn <- peek pcn
-    dn <- peek pdn
-    free psn
-    free pcn
-    free pdn
-    if res == 0 then return (sn,cn,dn)
-                else error $ "error code "++show res++
-                             " in elljac_e "++show u++" "++show m
-
-foreign import ccall "gsl_sf_elljac_e" gsl_sf_elljac_e :: Double -> Double -> Ptr Double -> Ptr Double -> Ptr Double -> IO CInt
diff --git a/lib/Numeric/GSL/Special/Erf.hs b/lib/Numeric/GSL/Special/Erf.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Erf.hs
+++ /dev/null
@@ -1,80 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Erf
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_erf.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Erf(
-  erfc_e
-, erfc
-, log_erfc_e
-, log_erfc
-, erf_e
-, erf
-, erf_Z_e
-, erf_Q_e
-, erf_Z
-, erf_Q
-, hazard_e
-, hazard
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-erfc_e :: Double -> (Double,Double)
-erfc_e x = createSFR "erfc_e" $ gsl_sf_erfc_e x
-foreign import ccall "gsl_sf_erfc_e" gsl_sf_erfc_e :: Double -> Ptr () -> IO CInt
-
-erfc :: Double -> Double
-erfc = gsl_sf_erfc
-foreign import ccall "gsl_sf_erfc" gsl_sf_erfc :: Double -> Double
-
-log_erfc_e :: Double -> (Double,Double)
-log_erfc_e x = createSFR "log_erfc_e" $ gsl_sf_log_erfc_e x
-foreign import ccall "gsl_sf_log_erfc_e" gsl_sf_log_erfc_e :: Double -> Ptr () -> IO CInt
-
-log_erfc :: Double -> Double
-log_erfc = gsl_sf_log_erfc
-foreign import ccall "gsl_sf_log_erfc" gsl_sf_log_erfc :: Double -> Double
-
-erf_e :: Double -> (Double,Double)
-erf_e x = createSFR "erf_e" $ gsl_sf_erf_e x
-foreign import ccall "gsl_sf_erf_e" gsl_sf_erf_e :: Double -> Ptr () -> IO CInt
-
-erf :: Double -> Double
-erf = gsl_sf_erf
-foreign import ccall "gsl_sf_erf" gsl_sf_erf :: Double -> Double
-
-erf_Z_e :: Double -> (Double,Double)
-erf_Z_e x = createSFR "erf_Z_e" $ gsl_sf_erf_Z_e x
-foreign import ccall "gsl_sf_erf_Z_e" gsl_sf_erf_Z_e :: Double -> Ptr () -> IO CInt
-
-erf_Q_e :: Double -> (Double,Double)
-erf_Q_e x = createSFR "erf_Q_e" $ gsl_sf_erf_Q_e x
-foreign import ccall "gsl_sf_erf_Q_e" gsl_sf_erf_Q_e :: Double -> Ptr () -> IO CInt
-
-erf_Z :: Double -> Double
-erf_Z = gsl_sf_erf_Z
-foreign import ccall "gsl_sf_erf_Z" gsl_sf_erf_Z :: Double -> Double
-
-erf_Q :: Double -> Double
-erf_Q = gsl_sf_erf_Q
-foreign import ccall "gsl_sf_erf_Q" gsl_sf_erf_Q :: Double -> Double
-
-hazard_e :: Double -> (Double,Double)
-hazard_e x = createSFR "hazard_e" $ gsl_sf_hazard_e x
-foreign import ccall "gsl_sf_hazard_e" gsl_sf_hazard_e :: Double -> Ptr () -> IO CInt
-
-hazard :: Double -> Double
-hazard = gsl_sf_hazard
-foreign import ccall "gsl_sf_hazard" gsl_sf_hazard :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Exp.hs b/lib/Numeric/GSL/Special/Exp.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Exp.hs
+++ /dev/null
@@ -1,115 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Exp
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_exp.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Exp(
-  exp_e
-, Numeric.GSL.Special.Exp.exp
-, exp_e10_e
-, exp_mult_e
-, exp_mult
-, exp_mult_e10_e
-, expm1_e
-, expm1
-, exprel_e
-, exprel
-, exprel_2_e
-, exprel_2
-, exprel_n_e
-, exprel_n
--- , exprel_n_CF_e
-, exp_err_e
-, exp_err_e10_e
-, exp_mult_err_e
-, exp_mult_err_e10_e
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-exp_e :: Double -> (Double,Double)
-exp_e x = createSFR "exp_e" $ gsl_sf_exp_e x
-foreign import ccall "gsl_sf_exp_e" gsl_sf_exp_e :: Double -> Ptr () -> IO CInt
-
-exp :: Double -> Double
-exp = gsl_sf_exp
-foreign import ccall "gsl_sf_exp" gsl_sf_exp :: Double -> Double
-
-exp_e10_e :: Double -> (Double,Int,Double)
-exp_e10_e x = createSFR_E10 "exp_e10_e" $ gsl_sf_exp_e10_e x
-foreign import ccall "gsl_sf_exp_e10_e" gsl_sf_exp_e10_e :: Double -> Ptr () -> IO CInt
-
-exp_mult_e :: Double -> Double -> (Double,Double)
-exp_mult_e x y = createSFR "exp_mult_e" $ gsl_sf_exp_mult_e x y
-foreign import ccall "gsl_sf_exp_mult_e" gsl_sf_exp_mult_e :: Double -> Double -> Ptr () -> IO CInt
-
-exp_mult :: Double -> Double -> Double
-exp_mult = gsl_sf_exp_mult
-foreign import ccall "gsl_sf_exp_mult" gsl_sf_exp_mult :: Double -> Double -> Double
-
-exp_mult_e10_e :: Double -> Double -> (Double,Int,Double)
-exp_mult_e10_e x y = createSFR_E10 "exp_mult_e10_e" $ gsl_sf_exp_mult_e10_e x y
-foreign import ccall "gsl_sf_exp_mult_e10_e" gsl_sf_exp_mult_e10_e :: Double -> Double -> Ptr () -> IO CInt
-
-expm1_e :: Double -> (Double,Double)
-expm1_e x = createSFR "expm1_e" $ gsl_sf_expm1_e x
-foreign import ccall "gsl_sf_expm1_e" gsl_sf_expm1_e :: Double -> Ptr () -> IO CInt
-
-expm1 :: Double -> Double
-expm1 = gsl_sf_expm1
-foreign import ccall "gsl_sf_expm1" gsl_sf_expm1 :: Double -> Double
-
-exprel_e :: Double -> (Double,Double)
-exprel_e x = createSFR "exprel_e" $ gsl_sf_exprel_e x
-foreign import ccall "gsl_sf_exprel_e" gsl_sf_exprel_e :: Double -> Ptr () -> IO CInt
-
-exprel :: Double -> Double
-exprel = gsl_sf_exprel
-foreign import ccall "gsl_sf_exprel" gsl_sf_exprel :: Double -> Double
-
-exprel_2_e :: Double -> (Double,Double)
-exprel_2_e x = createSFR "exprel_2_e" $ gsl_sf_exprel_2_e x
-foreign import ccall "gsl_sf_exprel_2_e" gsl_sf_exprel_2_e :: Double -> Ptr () -> IO CInt
-
-exprel_2 :: Double -> Double
-exprel_2 = gsl_sf_exprel_2
-foreign import ccall "gsl_sf_exprel_2" gsl_sf_exprel_2 :: Double -> Double
-
-exprel_n_e :: CInt -> Double -> (Double,Double)
-exprel_n_e n x = createSFR "exprel_n_e" $ gsl_sf_exprel_n_e n x
-foreign import ccall "gsl_sf_exprel_n_e" gsl_sf_exprel_n_e :: CInt -> Double -> Ptr () -> IO CInt
-
-exprel_n :: CInt -> Double -> Double
-exprel_n = gsl_sf_exprel_n
-foreign import ccall "gsl_sf_exprel_n" gsl_sf_exprel_n :: CInt -> Double -> Double
-
-exprel_n_CF_e :: Double -> Double -> (Double,Double)
-exprel_n_CF_e n x = createSFR "exprel_n_CF_e" $ gsl_sf_exprel_n_CF_e n x
-foreign import ccall "gsl_sf_exprel_n_CF_e" gsl_sf_exprel_n_CF_e :: Double -> Double -> Ptr () -> IO CInt
-
-exp_err_e :: Double -> Double -> (Double,Double)
-exp_err_e x dx = createSFR "exp_err_e" $ gsl_sf_exp_err_e x dx
-foreign import ccall "gsl_sf_exp_err_e" gsl_sf_exp_err_e :: Double -> Double -> Ptr () -> IO CInt
-
-exp_err_e10_e :: Double -> Double -> (Double,Int,Double)
-exp_err_e10_e x dx = createSFR_E10 "exp_err_e10_e" $ gsl_sf_exp_err_e10_e x dx
-foreign import ccall "gsl_sf_exp_err_e10_e" gsl_sf_exp_err_e10_e :: Double -> Double -> Ptr () -> IO CInt
-
-exp_mult_err_e :: Double -> Double -> Double -> Double -> (Double,Double)
-exp_mult_err_e x dx y dy = createSFR "exp_mult_err_e" $ gsl_sf_exp_mult_err_e x dx y dy
-foreign import ccall "gsl_sf_exp_mult_err_e" gsl_sf_exp_mult_err_e :: Double -> Double -> Double -> Double -> Ptr () -> IO CInt
-
-exp_mult_err_e10_e :: Double -> Double -> Double -> Double -> (Double,Int,Double)
-exp_mult_err_e10_e x dx y dy = createSFR_E10 "exp_mult_err_e10_e" $ gsl_sf_exp_mult_err_e10_e x dx y dy
-foreign import ccall "gsl_sf_exp_mult_err_e10_e" gsl_sf_exp_mult_err_e10_e :: Double -> Double -> Double -> Double -> Ptr () -> IO CInt
diff --git a/lib/Numeric/GSL/Special/Expint.hs b/lib/Numeric/GSL/Special/Expint.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Expint.hs
+++ /dev/null
@@ -1,160 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Expint
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_expint.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Expint(
-  expint_E1_e
-, expint_E1
-, expint_E2_e
-, expint_E2
-, expint_En_e
-, expint_En
-, expint_E1_scaled_e
-, expint_E1_scaled
-, expint_E2_scaled_e
-, expint_E2_scaled
-, expint_En_scaled_e
-, expint_En_scaled
-, expint_Ei_e
-, expint_Ei
-, expint_Ei_scaled_e
-, expint_Ei_scaled
-, shi_e
-, shi
-, chi_e
-, chi
-, expint_3_e
-, expint_3
-, si_e
-, si
-, ci_e
-, ci
-, atanint_e
-, atanint
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-expint_E1_e :: Double -> (Double,Double)
-expint_E1_e x = createSFR "expint_E1_e" $ gsl_sf_expint_E1_e x
-foreign import ccall "gsl_sf_expint_E1_e" gsl_sf_expint_E1_e :: Double -> Ptr () -> IO CInt
-
-expint_E1 :: Double -> Double
-expint_E1 = gsl_sf_expint_E1
-foreign import ccall "gsl_sf_expint_E1" gsl_sf_expint_E1 :: Double -> Double
-
-expint_E2_e :: Double -> (Double,Double)
-expint_E2_e x = createSFR "expint_E2_e" $ gsl_sf_expint_E2_e x
-foreign import ccall "gsl_sf_expint_E2_e" gsl_sf_expint_E2_e :: Double -> Ptr () -> IO CInt
-
-expint_E2 :: Double -> Double
-expint_E2 = gsl_sf_expint_E2
-foreign import ccall "gsl_sf_expint_E2" gsl_sf_expint_E2 :: Double -> Double
-
-expint_En_e :: CInt -> Double -> (Double,Double)
-expint_En_e n x = createSFR "expint_En_e" $ gsl_sf_expint_En_e n x
-foreign import ccall "gsl_sf_expint_En_e" gsl_sf_expint_En_e :: CInt -> Double -> Ptr () -> IO CInt
-
-expint_En :: CInt -> Double -> Double
-expint_En = gsl_sf_expint_En
-foreign import ccall "gsl_sf_expint_En" gsl_sf_expint_En :: CInt -> Double -> Double
-
-expint_E1_scaled_e :: Double -> (Double,Double)
-expint_E1_scaled_e x = createSFR "expint_E1_scaled_e" $ gsl_sf_expint_E1_scaled_e x
-foreign import ccall "gsl_sf_expint_E1_scaled_e" gsl_sf_expint_E1_scaled_e :: Double -> Ptr () -> IO CInt
-
-expint_E1_scaled :: Double -> Double
-expint_E1_scaled = gsl_sf_expint_E1_scaled
-foreign import ccall "gsl_sf_expint_E1_scaled" gsl_sf_expint_E1_scaled :: Double -> Double
-
-expint_E2_scaled_e :: Double -> (Double,Double)
-expint_E2_scaled_e x = createSFR "expint_E2_scaled_e" $ gsl_sf_expint_E2_scaled_e x
-foreign import ccall "gsl_sf_expint_E2_scaled_e" gsl_sf_expint_E2_scaled_e :: Double -> Ptr () -> IO CInt
-
-expint_E2_scaled :: Double -> Double
-expint_E2_scaled = gsl_sf_expint_E2_scaled
-foreign import ccall "gsl_sf_expint_E2_scaled" gsl_sf_expint_E2_scaled :: Double -> Double
-
-expint_En_scaled_e :: CInt -> Double -> (Double,Double)
-expint_En_scaled_e n x = createSFR "expint_En_scaled_e" $ gsl_sf_expint_En_scaled_e n x
-foreign import ccall "gsl_sf_expint_En_scaled_e" gsl_sf_expint_En_scaled_e :: CInt -> Double -> Ptr () -> IO CInt
-
-expint_En_scaled :: CInt -> Double -> Double
-expint_En_scaled = gsl_sf_expint_En_scaled
-foreign import ccall "gsl_sf_expint_En_scaled" gsl_sf_expint_En_scaled :: CInt -> Double -> Double
-
-expint_Ei_e :: Double -> (Double,Double)
-expint_Ei_e x = createSFR "expint_Ei_e" $ gsl_sf_expint_Ei_e x
-foreign import ccall "gsl_sf_expint_Ei_e" gsl_sf_expint_Ei_e :: Double -> Ptr () -> IO CInt
-
-expint_Ei :: Double -> Double
-expint_Ei = gsl_sf_expint_Ei
-foreign import ccall "gsl_sf_expint_Ei" gsl_sf_expint_Ei :: Double -> Double
-
-expint_Ei_scaled_e :: Double -> (Double,Double)
-expint_Ei_scaled_e x = createSFR "expint_Ei_scaled_e" $ gsl_sf_expint_Ei_scaled_e x
-foreign import ccall "gsl_sf_expint_Ei_scaled_e" gsl_sf_expint_Ei_scaled_e :: Double -> Ptr () -> IO CInt
-
-expint_Ei_scaled :: Double -> Double
-expint_Ei_scaled = gsl_sf_expint_Ei_scaled
-foreign import ccall "gsl_sf_expint_Ei_scaled" gsl_sf_expint_Ei_scaled :: Double -> Double
-
-shi_e :: Double -> (Double,Double)
-shi_e x = createSFR "shi_e" $ gsl_sf_Shi_e x
-foreign import ccall "gsl_sf_Shi_e" gsl_sf_Shi_e :: Double -> Ptr () -> IO CInt
-
-shi :: Double -> Double
-shi = gsl_sf_Shi
-foreign import ccall "gsl_sf_Shi" gsl_sf_Shi :: Double -> Double
-
-chi_e :: Double -> (Double,Double)
-chi_e x = createSFR "chi_e" $ gsl_sf_Chi_e x
-foreign import ccall "gsl_sf_Chi_e" gsl_sf_Chi_e :: Double -> Ptr () -> IO CInt
-
-chi :: Double -> Double
-chi = gsl_sf_Chi
-foreign import ccall "gsl_sf_Chi" gsl_sf_Chi :: Double -> Double
-
-expint_3_e :: Double -> (Double,Double)
-expint_3_e x = createSFR "expint_3_e" $ gsl_sf_expint_3_e x
-foreign import ccall "gsl_sf_expint_3_e" gsl_sf_expint_3_e :: Double -> Ptr () -> IO CInt
-
-expint_3 :: Double -> Double
-expint_3 = gsl_sf_expint_3
-foreign import ccall "gsl_sf_expint_3" gsl_sf_expint_3 :: Double -> Double
-
-si_e :: Double -> (Double,Double)
-si_e x = createSFR "si_e" $ gsl_sf_Si_e x
-foreign import ccall "gsl_sf_Si_e" gsl_sf_Si_e :: Double -> Ptr () -> IO CInt
-
-si :: Double -> Double
-si = gsl_sf_Si
-foreign import ccall "gsl_sf_Si" gsl_sf_Si :: Double -> Double
-
-ci_e :: Double -> (Double,Double)
-ci_e x = createSFR "ci_e" $ gsl_sf_Ci_e x
-foreign import ccall "gsl_sf_Ci_e" gsl_sf_Ci_e :: Double -> Ptr () -> IO CInt
-
-ci :: Double -> Double
-ci = gsl_sf_Ci
-foreign import ccall "gsl_sf_Ci" gsl_sf_Ci :: Double -> Double
-
-atanint_e :: Double -> (Double,Double)
-atanint_e x = createSFR "atanint_e" $ gsl_sf_atanint_e x
-foreign import ccall "gsl_sf_atanint_e" gsl_sf_atanint_e :: Double -> Ptr () -> IO CInt
-
-atanint :: Double -> Double
-atanint = gsl_sf_atanint
-foreign import ccall "gsl_sf_atanint" gsl_sf_atanint :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Fermi_dirac.hs b/lib/Numeric/GSL/Special/Fermi_dirac.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Fermi_dirac.hs
+++ /dev/null
@@ -1,110 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Fermi_dirac
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_fermi_dirac.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Fermi_dirac(
-  fermi_dirac_m1_e
-, fermi_dirac_m1
-, fermi_dirac_0_e
-, fermi_dirac_0
-, fermi_dirac_1_e
-, fermi_dirac_1
-, fermi_dirac_2_e
-, fermi_dirac_2
-, fermi_dirac_int_e
-, fermi_dirac_int
-, fermi_dirac_mhalf_e
-, fermi_dirac_mhalf
-, fermi_dirac_half_e
-, fermi_dirac_half
-, fermi_dirac_3half_e
-, fermi_dirac_3half
-, fermi_dirac_inc_0_e
-, fermi_dirac_inc_0
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-fermi_dirac_m1_e :: Double -> (Double,Double)
-fermi_dirac_m1_e x = createSFR "fermi_dirac_m1_e" $ gsl_sf_fermi_dirac_m1_e x
-foreign import ccall "gsl_sf_fermi_dirac_m1_e" gsl_sf_fermi_dirac_m1_e :: Double -> Ptr () -> IO CInt
-
-fermi_dirac_m1 :: Double -> Double
-fermi_dirac_m1 = gsl_sf_fermi_dirac_m1
-foreign import ccall "gsl_sf_fermi_dirac_m1" gsl_sf_fermi_dirac_m1 :: Double -> Double
-
-fermi_dirac_0_e :: Double -> (Double,Double)
-fermi_dirac_0_e x = createSFR "fermi_dirac_0_e" $ gsl_sf_fermi_dirac_0_e x
-foreign import ccall "gsl_sf_fermi_dirac_0_e" gsl_sf_fermi_dirac_0_e :: Double -> Ptr () -> IO CInt
-
-fermi_dirac_0 :: Double -> Double
-fermi_dirac_0 = gsl_sf_fermi_dirac_0
-foreign import ccall "gsl_sf_fermi_dirac_0" gsl_sf_fermi_dirac_0 :: Double -> Double
-
-fermi_dirac_1_e :: Double -> (Double,Double)
-fermi_dirac_1_e x = createSFR "fermi_dirac_1_e" $ gsl_sf_fermi_dirac_1_e x
-foreign import ccall "gsl_sf_fermi_dirac_1_e" gsl_sf_fermi_dirac_1_e :: Double -> Ptr () -> IO CInt
-
-fermi_dirac_1 :: Double -> Double
-fermi_dirac_1 = gsl_sf_fermi_dirac_1
-foreign import ccall "gsl_sf_fermi_dirac_1" gsl_sf_fermi_dirac_1 :: Double -> Double
-
-fermi_dirac_2_e :: Double -> (Double,Double)
-fermi_dirac_2_e x = createSFR "fermi_dirac_2_e" $ gsl_sf_fermi_dirac_2_e x
-foreign import ccall "gsl_sf_fermi_dirac_2_e" gsl_sf_fermi_dirac_2_e :: Double -> Ptr () -> IO CInt
-
-fermi_dirac_2 :: Double -> Double
-fermi_dirac_2 = gsl_sf_fermi_dirac_2
-foreign import ccall "gsl_sf_fermi_dirac_2" gsl_sf_fermi_dirac_2 :: Double -> Double
-
-fermi_dirac_int_e :: CInt -> Double -> (Double,Double)
-fermi_dirac_int_e j x = createSFR "fermi_dirac_int_e" $ gsl_sf_fermi_dirac_int_e j x
-foreign import ccall "gsl_sf_fermi_dirac_int_e" gsl_sf_fermi_dirac_int_e :: CInt -> Double -> Ptr () -> IO CInt
-
-fermi_dirac_int :: CInt -> Double -> Double
-fermi_dirac_int = gsl_sf_fermi_dirac_int
-foreign import ccall "gsl_sf_fermi_dirac_int" gsl_sf_fermi_dirac_int :: CInt -> Double -> Double
-
-fermi_dirac_mhalf_e :: Double -> (Double,Double)
-fermi_dirac_mhalf_e x = createSFR "fermi_dirac_mhalf_e" $ gsl_sf_fermi_dirac_mhalf_e x
-foreign import ccall "gsl_sf_fermi_dirac_mhalf_e" gsl_sf_fermi_dirac_mhalf_e :: Double -> Ptr () -> IO CInt
-
-fermi_dirac_mhalf :: Double -> Double
-fermi_dirac_mhalf = gsl_sf_fermi_dirac_mhalf
-foreign import ccall "gsl_sf_fermi_dirac_mhalf" gsl_sf_fermi_dirac_mhalf :: Double -> Double
-
-fermi_dirac_half_e :: Double -> (Double,Double)
-fermi_dirac_half_e x = createSFR "fermi_dirac_half_e" $ gsl_sf_fermi_dirac_half_e x
-foreign import ccall "gsl_sf_fermi_dirac_half_e" gsl_sf_fermi_dirac_half_e :: Double -> Ptr () -> IO CInt
-
-fermi_dirac_half :: Double -> Double
-fermi_dirac_half = gsl_sf_fermi_dirac_half
-foreign import ccall "gsl_sf_fermi_dirac_half" gsl_sf_fermi_dirac_half :: Double -> Double
-
-fermi_dirac_3half_e :: Double -> (Double,Double)
-fermi_dirac_3half_e x = createSFR "fermi_dirac_3half_e" $ gsl_sf_fermi_dirac_3half_e x
-foreign import ccall "gsl_sf_fermi_dirac_3half_e" gsl_sf_fermi_dirac_3half_e :: Double -> Ptr () -> IO CInt
-
-fermi_dirac_3half :: Double -> Double
-fermi_dirac_3half = gsl_sf_fermi_dirac_3half
-foreign import ccall "gsl_sf_fermi_dirac_3half" gsl_sf_fermi_dirac_3half :: Double -> Double
-
-fermi_dirac_inc_0_e :: Double -> Double -> (Double,Double)
-fermi_dirac_inc_0_e x b = createSFR "fermi_dirac_inc_0_e" $ gsl_sf_fermi_dirac_inc_0_e x b
-foreign import ccall "gsl_sf_fermi_dirac_inc_0_e" gsl_sf_fermi_dirac_inc_0_e :: Double -> Double -> Ptr () -> IO CInt
-
-fermi_dirac_inc_0 :: Double -> Double -> Double
-fermi_dirac_inc_0 = gsl_sf_fermi_dirac_inc_0
-foreign import ccall "gsl_sf_fermi_dirac_inc_0" gsl_sf_fermi_dirac_inc_0 :: Double -> Double -> Double
diff --git a/lib/Numeric/GSL/Special/Gamma.hs b/lib/Numeric/GSL/Special/Gamma.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Gamma.hs
+++ /dev/null
@@ -1,236 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Gamma
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_gamma.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Gamma(
-  lngamma_e
-, lngamma
-, gamma_e
-, gamma
-, gammastar_e
-, gammastar
-, gammainv_e
-, gammainv
-, taylorcoeff_e
-, taylorcoeff
-, fact_e
-, fact
-, doublefact_e
-, doublefact
-, lnfact_e
-, lnfact
-, lndoublefact_e
-, lndoublefact
-, lnchoose_e
-, lnchoose
-, choose_e
-, choose
-, lnpoch_e
-, lnpoch
-, poch_e
-, poch
-, pochrel_e
-, pochrel
-, gamma_inc_Q_e
-, gamma_inc_Q
-, gamma_inc_P_e
-, gamma_inc_P
-, gamma_inc_e
-, gamma_inc
-, lnbeta_e
-, lnbeta
-, beta_e
-, beta
-, beta_inc_e
-, beta_inc
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-lngamma_e :: Double -> (Double,Double)
-lngamma_e x = createSFR "lngamma_e" $ gsl_sf_lngamma_e x
-foreign import ccall "gsl_sf_lngamma_e" gsl_sf_lngamma_e :: Double -> Ptr () -> IO CInt
-
-lngamma :: Double -> Double
-lngamma = gsl_sf_lngamma
-foreign import ccall "gsl_sf_lngamma" gsl_sf_lngamma :: Double -> Double
-
-lngamma_sgn_e :: Double -> Ptr () -> Ptr Double -> CInt
-lngamma_sgn_e = gsl_sf_lngamma_sgn_e
-foreign import ccall "gsl_sf_lngamma_sgn_e" gsl_sf_lngamma_sgn_e :: Double -> Ptr () -> Ptr Double -> CInt
-
-gamma_e :: Double -> (Double,Double)
-gamma_e x = createSFR "gamma_e" $ gsl_sf_gamma_e x
-foreign import ccall "gsl_sf_gamma_e" gsl_sf_gamma_e :: Double -> Ptr () -> IO CInt
-
-gamma :: Double -> Double
-gamma = gsl_sf_gamma
-foreign import ccall "gsl_sf_gamma" gsl_sf_gamma :: Double -> Double
-
-gammastar_e :: Double -> (Double,Double)
-gammastar_e x = createSFR "gammastar_e" $ gsl_sf_gammastar_e x
-foreign import ccall "gsl_sf_gammastar_e" gsl_sf_gammastar_e :: Double -> Ptr () -> IO CInt
-
-gammastar :: Double -> Double
-gammastar = gsl_sf_gammastar
-foreign import ccall "gsl_sf_gammastar" gsl_sf_gammastar :: Double -> Double
-
-gammainv_e :: Double -> (Double,Double)
-gammainv_e x = createSFR "gammainv_e" $ gsl_sf_gammainv_e x
-foreign import ccall "gsl_sf_gammainv_e" gsl_sf_gammainv_e :: Double -> Ptr () -> IO CInt
-
-gammainv :: Double -> Double
-gammainv = gsl_sf_gammainv
-foreign import ccall "gsl_sf_gammainv" gsl_sf_gammainv :: Double -> Double
-
-lngamma_complex_e :: Double -> Double -> Ptr () -> (Double,Double)
-lngamma_complex_e zr zi lnr = createSFR "lngamma_complex_e" $ gsl_sf_lngamma_complex_e zr zi lnr
-foreign import ccall "gsl_sf_lngamma_complex_e" gsl_sf_lngamma_complex_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-taylorcoeff_e :: CInt -> Double -> (Double,Double)
-taylorcoeff_e n x = createSFR "taylorcoeff_e" $ gsl_sf_taylorcoeff_e n x
-foreign import ccall "gsl_sf_taylorcoeff_e" gsl_sf_taylorcoeff_e :: CInt -> Double -> Ptr () -> IO CInt
-
-taylorcoeff :: CInt -> Double -> Double
-taylorcoeff = gsl_sf_taylorcoeff
-foreign import ccall "gsl_sf_taylorcoeff" gsl_sf_taylorcoeff :: CInt -> Double -> Double
-
-fact_e :: CInt -> (Double,Double)
-fact_e n = createSFR "fact_e" $ gsl_sf_fact_e n
-foreign import ccall "gsl_sf_fact_e" gsl_sf_fact_e :: CInt -> Ptr () -> IO CInt
-
-fact :: CInt -> Double
-fact = gsl_sf_fact
-foreign import ccall "gsl_sf_fact" gsl_sf_fact :: CInt -> Double
-
-doublefact_e :: CInt -> (Double,Double)
-doublefact_e n = createSFR "doublefact_e" $ gsl_sf_doublefact_e n
-foreign import ccall "gsl_sf_doublefact_e" gsl_sf_doublefact_e :: CInt -> Ptr () -> IO CInt
-
-doublefact :: CInt -> Double
-doublefact = gsl_sf_doublefact
-foreign import ccall "gsl_sf_doublefact" gsl_sf_doublefact :: CInt -> Double
-
-lnfact_e :: CInt -> (Double,Double)
-lnfact_e n = createSFR "lnfact_e" $ gsl_sf_lnfact_e n
-foreign import ccall "gsl_sf_lnfact_e" gsl_sf_lnfact_e :: CInt -> Ptr () -> IO CInt
-
-lnfact :: CInt -> Double
-lnfact = gsl_sf_lnfact
-foreign import ccall "gsl_sf_lnfact" gsl_sf_lnfact :: CInt -> Double
-
-lndoublefact_e :: CInt -> (Double,Double)
-lndoublefact_e n = createSFR "lndoublefact_e" $ gsl_sf_lndoublefact_e n
-foreign import ccall "gsl_sf_lndoublefact_e" gsl_sf_lndoublefact_e :: CInt -> Ptr () -> IO CInt
-
-lndoublefact :: CInt -> Double
-lndoublefact = gsl_sf_lndoublefact
-foreign import ccall "gsl_sf_lndoublefact" gsl_sf_lndoublefact :: CInt -> Double
-
-lnchoose_e :: CInt -> CInt -> (Double,Double)
-lnchoose_e n m = createSFR "lnchoose_e" $ gsl_sf_lnchoose_e n m
-foreign import ccall "gsl_sf_lnchoose_e" gsl_sf_lnchoose_e :: CInt -> CInt -> Ptr () -> IO CInt
-
-lnchoose :: CInt -> CInt -> Double
-lnchoose = gsl_sf_lnchoose
-foreign import ccall "gsl_sf_lnchoose" gsl_sf_lnchoose :: CInt -> CInt -> Double
-
-choose_e :: CInt -> CInt -> (Double,Double)
-choose_e n m = createSFR "choose_e" $ gsl_sf_choose_e n m
-foreign import ccall "gsl_sf_choose_e" gsl_sf_choose_e :: CInt -> CInt -> Ptr () -> IO CInt
-
-choose :: CInt -> CInt -> Double
-choose = gsl_sf_choose
-foreign import ccall "gsl_sf_choose" gsl_sf_choose :: CInt -> CInt -> Double
-
-lnpoch_e :: Double -> Double -> (Double,Double)
-lnpoch_e a x = createSFR "lnpoch_e" $ gsl_sf_lnpoch_e a x
-foreign import ccall "gsl_sf_lnpoch_e" gsl_sf_lnpoch_e :: Double -> Double -> Ptr () -> IO CInt
-
-lnpoch :: Double -> Double -> Double
-lnpoch = gsl_sf_lnpoch
-foreign import ccall "gsl_sf_lnpoch" gsl_sf_lnpoch :: Double -> Double -> Double
-
-lnpoch_sgn_e :: Double -> Double -> Ptr () -> Ptr Double -> CInt
-lnpoch_sgn_e = gsl_sf_lnpoch_sgn_e
-foreign import ccall "gsl_sf_lnpoch_sgn_e" gsl_sf_lnpoch_sgn_e :: Double -> Double -> Ptr () -> Ptr Double -> CInt
-
-poch_e :: Double -> Double -> (Double,Double)
-poch_e a x = createSFR "poch_e" $ gsl_sf_poch_e a x
-foreign import ccall "gsl_sf_poch_e" gsl_sf_poch_e :: Double -> Double -> Ptr () -> IO CInt
-
-poch :: Double -> Double -> Double
-poch = gsl_sf_poch
-foreign import ccall "gsl_sf_poch" gsl_sf_poch :: Double -> Double -> Double
-
-pochrel_e :: Double -> Double -> (Double,Double)
-pochrel_e a x = createSFR "pochrel_e" $ gsl_sf_pochrel_e a x
-foreign import ccall "gsl_sf_pochrel_e" gsl_sf_pochrel_e :: Double -> Double -> Ptr () -> IO CInt
-
-pochrel :: Double -> Double -> Double
-pochrel = gsl_sf_pochrel
-foreign import ccall "gsl_sf_pochrel" gsl_sf_pochrel :: Double -> Double -> Double
-
-gamma_inc_Q_e :: Double -> Double -> (Double,Double)
-gamma_inc_Q_e a x = createSFR "gamma_inc_Q_e" $ gsl_sf_gamma_inc_Q_e a x
-foreign import ccall "gsl_sf_gamma_inc_Q_e" gsl_sf_gamma_inc_Q_e :: Double -> Double -> Ptr () -> IO CInt
-
-gamma_inc_Q :: Double -> Double -> Double
-gamma_inc_Q = gsl_sf_gamma_inc_Q
-foreign import ccall "gsl_sf_gamma_inc_Q" gsl_sf_gamma_inc_Q :: Double -> Double -> Double
-
-gamma_inc_P_e :: Double -> Double -> (Double,Double)
-gamma_inc_P_e a x = createSFR "gamma_inc_P_e" $ gsl_sf_gamma_inc_P_e a x
-foreign import ccall "gsl_sf_gamma_inc_P_e" gsl_sf_gamma_inc_P_e :: Double -> Double -> Ptr () -> IO CInt
-
-gamma_inc_P :: Double -> Double -> Double
-gamma_inc_P = gsl_sf_gamma_inc_P
-foreign import ccall "gsl_sf_gamma_inc_P" gsl_sf_gamma_inc_P :: Double -> Double -> Double
-
-gamma_inc_e :: Double -> Double -> (Double,Double)
-gamma_inc_e a x = createSFR "gamma_inc_e" $ gsl_sf_gamma_inc_e a x
-foreign import ccall "gsl_sf_gamma_inc_e" gsl_sf_gamma_inc_e :: Double -> Double -> Ptr () -> IO CInt
-
-gamma_inc :: Double -> Double -> Double
-gamma_inc = gsl_sf_gamma_inc
-foreign import ccall "gsl_sf_gamma_inc" gsl_sf_gamma_inc :: Double -> Double -> Double
-
-lnbeta_e :: Double -> Double -> (Double,Double)
-lnbeta_e a b = createSFR "lnbeta_e" $ gsl_sf_lnbeta_e a b
-foreign import ccall "gsl_sf_lnbeta_e" gsl_sf_lnbeta_e :: Double -> Double -> Ptr () -> IO CInt
-
-lnbeta :: Double -> Double -> Double
-lnbeta = gsl_sf_lnbeta
-foreign import ccall "gsl_sf_lnbeta" gsl_sf_lnbeta :: Double -> Double -> Double
-
-lnbeta_sgn_e :: Double -> Double -> Ptr () -> Ptr Double -> CInt
-lnbeta_sgn_e = gsl_sf_lnbeta_sgn_e
-foreign import ccall "gsl_sf_lnbeta_sgn_e" gsl_sf_lnbeta_sgn_e :: Double -> Double -> Ptr () -> Ptr Double -> CInt
-
-beta_e :: Double -> Double -> (Double,Double)
-beta_e a b = createSFR "beta_e" $ gsl_sf_beta_e a b
-foreign import ccall "gsl_sf_beta_e" gsl_sf_beta_e :: Double -> Double -> Ptr () -> IO CInt
-
-beta :: Double -> Double -> Double
-beta = gsl_sf_beta
-foreign import ccall "gsl_sf_beta" gsl_sf_beta :: Double -> Double -> Double
-
-beta_inc_e :: Double -> Double -> Double -> (Double,Double)
-beta_inc_e a b x = createSFR "beta_inc_e" $ gsl_sf_beta_inc_e a b x
-foreign import ccall "gsl_sf_beta_inc_e" gsl_sf_beta_inc_e :: Double -> Double -> Double -> Ptr () -> IO CInt
-
-beta_inc :: Double -> Double -> Double -> Double
-beta_inc = gsl_sf_beta_inc
-foreign import ccall "gsl_sf_beta_inc" gsl_sf_beta_inc :: Double -> Double -> Double -> Double
diff --git a/lib/Numeric/GSL/Special/Gegenbauer.hs b/lib/Numeric/GSL/Special/Gegenbauer.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Gegenbauer.hs
+++ /dev/null
@@ -1,64 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Gegenbauer
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_gegenbauer.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Gegenbauer(
-  gegenpoly_1_e
-, gegenpoly_2_e
-, gegenpoly_3_e
-, gegenpoly_1
-, gegenpoly_2
-, gegenpoly_3
-, gegenpoly_n_e
-, gegenpoly_n
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-gegenpoly_1_e :: Double -> Double -> (Double,Double)
-gegenpoly_1_e lambda x = createSFR "gegenpoly_1_e" $ gsl_sf_gegenpoly_1_e lambda x
-foreign import ccall "gsl_sf_gegenpoly_1_e" gsl_sf_gegenpoly_1_e :: Double -> Double -> Ptr () -> IO CInt
-
-gegenpoly_2_e :: Double -> Double -> (Double,Double)
-gegenpoly_2_e lambda x = createSFR "gegenpoly_2_e" $ gsl_sf_gegenpoly_2_e lambda x
-foreign import ccall "gsl_sf_gegenpoly_2_e" gsl_sf_gegenpoly_2_e :: Double -> Double -> Ptr () -> IO CInt
-
-gegenpoly_3_e :: Double -> Double -> (Double,Double)
-gegenpoly_3_e lambda x = createSFR "gegenpoly_3_e" $ gsl_sf_gegenpoly_3_e lambda x
-foreign import ccall "gsl_sf_gegenpoly_3_e" gsl_sf_gegenpoly_3_e :: Double -> Double -> Ptr () -> IO CInt
-
-gegenpoly_1 :: Double -> Double -> Double
-gegenpoly_1 = gsl_sf_gegenpoly_1
-foreign import ccall "gsl_sf_gegenpoly_1" gsl_sf_gegenpoly_1 :: Double -> Double -> Double
-
-gegenpoly_2 :: Double -> Double -> Double
-gegenpoly_2 = gsl_sf_gegenpoly_2
-foreign import ccall "gsl_sf_gegenpoly_2" gsl_sf_gegenpoly_2 :: Double -> Double -> Double
-
-gegenpoly_3 :: Double -> Double -> Double
-gegenpoly_3 = gsl_sf_gegenpoly_3
-foreign import ccall "gsl_sf_gegenpoly_3" gsl_sf_gegenpoly_3 :: Double -> Double -> Double
-
-gegenpoly_n_e :: CInt -> Double -> Double -> (Double,Double)
-gegenpoly_n_e n lambda x = createSFR "gegenpoly_n_e" $ gsl_sf_gegenpoly_n_e n lambda x
-foreign import ccall "gsl_sf_gegenpoly_n_e" gsl_sf_gegenpoly_n_e :: CInt -> Double -> Double -> Ptr () -> IO CInt
-
-gegenpoly_n :: CInt -> Double -> Double -> Double
-gegenpoly_n = gsl_sf_gegenpoly_n
-foreign import ccall "gsl_sf_gegenpoly_n" gsl_sf_gegenpoly_n :: CInt -> Double -> Double -> Double
-
-gegenpoly_array :: CInt -> Double -> Double -> Ptr Double -> CInt
-gegenpoly_array = gsl_sf_gegenpoly_array
-foreign import ccall "gsl_sf_gegenpoly_array" gsl_sf_gegenpoly_array :: CInt -> Double -> Double -> Ptr Double -> CInt
diff --git a/lib/Numeric/GSL/Special/Hyperg.hs b/lib/Numeric/GSL/Special/Hyperg.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Hyperg.hs
+++ /dev/null
@@ -1,130 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Hyperg
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_hyperg.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Hyperg(
-  hyperg_0F1_e
-, hyperg_0F1
-, hyperg_1F1_int_e
-, hyperg_1F1_int
-, hyperg_1F1_e
-, hyperg_1F1
-, hyperg_U_int_e
-, hyperg_U_int
-, hyperg_U_int_e10_e
-, hyperg_U_e
-, hyperg_U
-, hyperg_U_e10_e
-, hyperg_2F1_e
-, hyperg_2F1
-, hyperg_2F1_conj_e
-, hyperg_2F1_conj
-, hyperg_2F1_renorm_e
-, hyperg_2F1_renorm
-, hyperg_2F1_conj_renorm_e
-, hyperg_2F1_conj_renorm
-, hyperg_2F0_e
-, hyperg_2F0
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-hyperg_0F1_e :: Double -> Double -> (Double,Double)
-hyperg_0F1_e c x = createSFR "hyperg_0F1_e" $ gsl_sf_hyperg_0F1_e c x
-foreign import ccall "gsl_sf_hyperg_0F1_e" gsl_sf_hyperg_0F1_e :: Double -> Double -> Ptr () -> IO CInt
-
-hyperg_0F1 :: Double -> Double -> Double
-hyperg_0F1 = gsl_sf_hyperg_0F1
-foreign import ccall "gsl_sf_hyperg_0F1" gsl_sf_hyperg_0F1 :: Double -> Double -> Double
-
-hyperg_1F1_int_e :: CInt -> CInt -> Double -> (Double,Double)
-hyperg_1F1_int_e m n x = createSFR "hyperg_1F1_int_e" $ gsl_sf_hyperg_1F1_int_e m n x
-foreign import ccall "gsl_sf_hyperg_1F1_int_e" gsl_sf_hyperg_1F1_int_e :: CInt -> CInt -> Double -> Ptr () -> IO CInt
-
-hyperg_1F1_int :: CInt -> CInt -> Double -> Double
-hyperg_1F1_int = gsl_sf_hyperg_1F1_int
-foreign import ccall "gsl_sf_hyperg_1F1_int" gsl_sf_hyperg_1F1_int :: CInt -> CInt -> Double -> Double
-
-hyperg_1F1_e :: Double -> Double -> Double -> (Double,Double)
-hyperg_1F1_e a b x = createSFR "hyperg_1F1_e" $ gsl_sf_hyperg_1F1_e a b x
-foreign import ccall "gsl_sf_hyperg_1F1_e" gsl_sf_hyperg_1F1_e :: Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_1F1 :: Double -> Double -> Double -> Double
-hyperg_1F1 = gsl_sf_hyperg_1F1
-foreign import ccall "gsl_sf_hyperg_1F1" gsl_sf_hyperg_1F1 :: Double -> Double -> Double -> Double
-
-hyperg_U_int_e :: CInt -> CInt -> Double -> (Double,Double)
-hyperg_U_int_e m n x = createSFR "hyperg_U_int_e" $ gsl_sf_hyperg_U_int_e m n x
-foreign import ccall "gsl_sf_hyperg_U_int_e" gsl_sf_hyperg_U_int_e :: CInt -> CInt -> Double -> Ptr () -> IO CInt
-
-hyperg_U_int :: CInt -> CInt -> Double -> Double
-hyperg_U_int = gsl_sf_hyperg_U_int
-foreign import ccall "gsl_sf_hyperg_U_int" gsl_sf_hyperg_U_int :: CInt -> CInt -> Double -> Double
-
-hyperg_U_int_e10_e :: CInt -> CInt -> Double -> (Double,Int,Double)
-hyperg_U_int_e10_e m n x = createSFR_E10 "hyperg_U_int_e10_e" $ gsl_sf_hyperg_U_int_e10_e m n x
-foreign import ccall "gsl_sf_hyperg_U_int_e10_e" gsl_sf_hyperg_U_int_e10_e :: CInt -> CInt -> Double -> Ptr () -> IO CInt
-
-hyperg_U_e :: Double -> Double -> Double -> (Double,Double)
-hyperg_U_e a b x = createSFR "hyperg_U_e" $ gsl_sf_hyperg_U_e a b x
-foreign import ccall "gsl_sf_hyperg_U_e" gsl_sf_hyperg_U_e :: Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_U :: Double -> Double -> Double -> Double
-hyperg_U = gsl_sf_hyperg_U
-foreign import ccall "gsl_sf_hyperg_U" gsl_sf_hyperg_U :: Double -> Double -> Double -> Double
-
-hyperg_U_e10_e :: Double -> Double -> Double -> (Double,Int,Double)
-hyperg_U_e10_e a b x = createSFR_E10 "hyperg_U_e10_e" $ gsl_sf_hyperg_U_e10_e a b x
-foreign import ccall "gsl_sf_hyperg_U_e10_e" gsl_sf_hyperg_U_e10_e :: Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_2F1_e :: Double -> Double -> Double -> Double -> (Double,Double)
-hyperg_2F1_e a b c x = createSFR "hyperg_2F1_e" $ gsl_sf_hyperg_2F1_e a b c x
-foreign import ccall "gsl_sf_hyperg_2F1_e" gsl_sf_hyperg_2F1_e :: Double -> Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_2F1 :: Double -> Double -> Double -> Double -> Double
-hyperg_2F1 = gsl_sf_hyperg_2F1
-foreign import ccall "gsl_sf_hyperg_2F1" gsl_sf_hyperg_2F1 :: Double -> Double -> Double -> Double -> Double
-
-hyperg_2F1_conj_e :: Double -> Double -> Double -> Double -> (Double,Double)
-hyperg_2F1_conj_e aR aI c x = createSFR "hyperg_2F1_conj_e" $ gsl_sf_hyperg_2F1_conj_e aR aI c x
-foreign import ccall "gsl_sf_hyperg_2F1_conj_e" gsl_sf_hyperg_2F1_conj_e :: Double -> Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_2F1_conj :: Double -> Double -> Double -> Double -> Double
-hyperg_2F1_conj = gsl_sf_hyperg_2F1_conj
-foreign import ccall "gsl_sf_hyperg_2F1_conj" gsl_sf_hyperg_2F1_conj :: Double -> Double -> Double -> Double -> Double
-
-hyperg_2F1_renorm_e :: Double -> Double -> Double -> Double -> (Double,Double)
-hyperg_2F1_renorm_e a b c x = createSFR "hyperg_2F1_renorm_e" $ gsl_sf_hyperg_2F1_renorm_e a b c x
-foreign import ccall "gsl_sf_hyperg_2F1_renorm_e" gsl_sf_hyperg_2F1_renorm_e :: Double -> Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_2F1_renorm :: Double -> Double -> Double -> Double -> Double
-hyperg_2F1_renorm = gsl_sf_hyperg_2F1_renorm
-foreign import ccall "gsl_sf_hyperg_2F1_renorm" gsl_sf_hyperg_2F1_renorm :: Double -> Double -> Double -> Double -> Double
-
-hyperg_2F1_conj_renorm_e :: Double -> Double -> Double -> Double -> (Double,Double)
-hyperg_2F1_conj_renorm_e aR aI c x = createSFR "hyperg_2F1_conj_renorm_e" $ gsl_sf_hyperg_2F1_conj_renorm_e aR aI c x
-foreign import ccall "gsl_sf_hyperg_2F1_conj_renorm_e" gsl_sf_hyperg_2F1_conj_renorm_e :: Double -> Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_2F1_conj_renorm :: Double -> Double -> Double -> Double -> Double
-hyperg_2F1_conj_renorm = gsl_sf_hyperg_2F1_conj_renorm
-foreign import ccall "gsl_sf_hyperg_2F1_conj_renorm" gsl_sf_hyperg_2F1_conj_renorm :: Double -> Double -> Double -> Double -> Double
-
-hyperg_2F0_e :: Double -> Double -> Double -> (Double,Double)
-hyperg_2F0_e a b x = createSFR "hyperg_2F0_e" $ gsl_sf_hyperg_2F0_e a b x
-foreign import ccall "gsl_sf_hyperg_2F0_e" gsl_sf_hyperg_2F0_e :: Double -> Double -> Double -> Ptr () -> IO CInt
-
-hyperg_2F0 :: Double -> Double -> Double -> Double
-hyperg_2F0 = gsl_sf_hyperg_2F0
-foreign import ccall "gsl_sf_hyperg_2F0" gsl_sf_hyperg_2F0 :: Double -> Double -> Double -> Double
diff --git a/lib/Numeric/GSL/Special/Internal.hsc b/lib/Numeric/GSL/Special/Internal.hsc
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Internal.hsc
+++ /dev/null
@@ -1,102 +0,0 @@
- {-# LANGUAGE ForeignFunctionInterface #-}
------------------------------------------------------------------------------
-{- |
-Module      :  Numeric.GSL.Special.Internal
-Copyright   :  (c) Alberto Ruiz 2007
-License     :  GPL-style
-
-Maintainer  :  Alberto Ruiz (aruiz at um dot es)
-Stability   :  provisional
-Portability :  uses ffi
-
-Support for Special functions.
-
-<http://www.gnu.org/software/gsl/manual/html_node/Special-Functions.html#Special-Functions>
--}
------------------------------------------------------------------------------
-
-#include <gsl/gsl_sf_result.h>
-#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)
-
-module Numeric.GSL.Special.Internal (
-    createSFR,
-    createSFR_E10,
-    Precision(..),
-    Gsl_mode_t,
-    Size_t,
-    precCode
-)
-where
-
-import Foreign
-import Data.Packed.Internal(check,(//))
-import Foreign.C.Types(CSize,CInt)
-
-
-data Precision = PrecDouble | PrecSingle | PrecApprox
-
-precCode :: Precision -> Int
-precCode PrecDouble = 0
-precCode PrecSingle = 1
-precCode PrecApprox = 2
-
-type Gsl_mode_t = Int
-
-type Size_t = CSize
-
----------------------------------------------------
-
-data Gsl_sf_result = SF Double Double
-  deriving (Show)
-
-instance Storable Gsl_sf_result where
-  sizeOf _ = #size gsl_sf_result
-  alignment _ = #alignment gsl_sf_result
-  peek ptr = do
-    val <- (#peek gsl_sf_result, val) ptr
-    err <- (#peek gsl_sf_result, err) ptr
-    return (SF val err)
-  poke ptr (SF val err) = do
-    (#poke gsl_sf_result, val) ptr val
-    (#poke gsl_sf_result, err) ptr err
-
-
-data Gsl_sf_result_e10 = SFE Double Double CInt
-  deriving (Show)
-
-instance Storable Gsl_sf_result_e10 where
-  sizeOf _ = #size gsl_sf_result_e10
-  alignment _ = #alignment gsl_sf_result_e10
-  peek ptr = do
-    val <- (#peek gsl_sf_result_e10, val) ptr
-    err <- (#peek gsl_sf_result_e10, err) ptr
-    e10 <- (#peek gsl_sf_result_e10, e10) ptr
-    return (SFE val err e10)
-  poke ptr (SFE val err e10) = do
-    (#poke gsl_sf_result_e10, val) ptr val
-    (#poke gsl_sf_result_e10, err) ptr err
-    (#poke gsl_sf_result_e10, e10) ptr e10
-
-
-----------------------------------------------------------------
--- | access to a sf_result
-createSFR :: String -> (Ptr a -> IO CInt) -> (Double, Double)
-createSFR s f = unsafePerformIO $ do
-    p <- malloc :: IO (Ptr Gsl_sf_result)
-    f (castPtr p) // check s
-    SF val err <- peek p
-    free p
-    return (val,err)
-
-
----------------------------------------------------------------------
--- the sf_result_e10 contains two doubles and the exponent
-
--- | access to sf_result_e10
-createSFR_E10 :: String -> (Ptr a -> IO CInt) -> (Double, Int, Double)
-createSFR_E10 s f = unsafePerformIO $ do
-    p <- malloc :: IO (Ptr Gsl_sf_result_e10)
-    f (castPtr p) // check s
-    SFE val err expo  <- peek p
-    free p
-    return (val, fromIntegral expo,err)
diff --git a/lib/Numeric/GSL/Special/Laguerre.hs b/lib/Numeric/GSL/Special/Laguerre.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Laguerre.hs
+++ /dev/null
@@ -1,60 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Laguerre
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_laguerre.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Laguerre(
-  laguerre_1_e
-, laguerre_2_e
-, laguerre_3_e
-, laguerre_1
-, laguerre_2
-, laguerre_3
-, laguerre_n_e
-, laguerre_n
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-laguerre_1_e :: Double -> Double -> (Double,Double)
-laguerre_1_e a x = createSFR "laguerre_1_e" $ gsl_sf_laguerre_1_e a x
-foreign import ccall "gsl_sf_laguerre_1_e" gsl_sf_laguerre_1_e :: Double -> Double -> Ptr () -> IO CInt
-
-laguerre_2_e :: Double -> Double -> (Double,Double)
-laguerre_2_e a x = createSFR "laguerre_2_e" $ gsl_sf_laguerre_2_e a x
-foreign import ccall "gsl_sf_laguerre_2_e" gsl_sf_laguerre_2_e :: Double -> Double -> Ptr () -> IO CInt
-
-laguerre_3_e :: Double -> Double -> (Double,Double)
-laguerre_3_e a x = createSFR "laguerre_3_e" $ gsl_sf_laguerre_3_e a x
-foreign import ccall "gsl_sf_laguerre_3_e" gsl_sf_laguerre_3_e :: Double -> Double -> Ptr () -> IO CInt
-
-laguerre_1 :: Double -> Double -> Double
-laguerre_1 = gsl_sf_laguerre_1
-foreign import ccall "gsl_sf_laguerre_1" gsl_sf_laguerre_1 :: Double -> Double -> Double
-
-laguerre_2 :: Double -> Double -> Double
-laguerre_2 = gsl_sf_laguerre_2
-foreign import ccall "gsl_sf_laguerre_2" gsl_sf_laguerre_2 :: Double -> Double -> Double
-
-laguerre_3 :: Double -> Double -> Double
-laguerre_3 = gsl_sf_laguerre_3
-foreign import ccall "gsl_sf_laguerre_3" gsl_sf_laguerre_3 :: Double -> Double -> Double
-
-laguerre_n_e :: CInt -> Double -> Double -> (Double,Double)
-laguerre_n_e n a x = createSFR "laguerre_n_e" $ gsl_sf_laguerre_n_e n a x
-foreign import ccall "gsl_sf_laguerre_n_e" gsl_sf_laguerre_n_e :: CInt -> Double -> Double -> Ptr () -> IO CInt
-
-laguerre_n :: CInt -> Double -> Double -> Double
-laguerre_n = gsl_sf_laguerre_n
-foreign import ccall "gsl_sf_laguerre_n" gsl_sf_laguerre_n :: CInt -> Double -> Double -> Double
diff --git a/lib/Numeric/GSL/Special/Lambert.hs b/lib/Numeric/GSL/Special/Lambert.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Lambert.hs
+++ /dev/null
@@ -1,40 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Lambert
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_lambert.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Lambert(
-  lambert_W0_e
-, lambert_W0
-, lambert_Wm1_e
-, lambert_Wm1
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-lambert_W0_e :: Double -> (Double,Double)
-lambert_W0_e x = createSFR "lambert_W0_e" $ gsl_sf_lambert_W0_e x
-foreign import ccall "gsl_sf_lambert_W0_e" gsl_sf_lambert_W0_e :: Double -> Ptr () -> IO CInt
-
-lambert_W0 :: Double -> Double
-lambert_W0 = gsl_sf_lambert_W0
-foreign import ccall "gsl_sf_lambert_W0" gsl_sf_lambert_W0 :: Double -> Double
-
-lambert_Wm1_e :: Double -> (Double,Double)
-lambert_Wm1_e x = createSFR "lambert_Wm1_e" $ gsl_sf_lambert_Wm1_e x
-foreign import ccall "gsl_sf_lambert_Wm1_e" gsl_sf_lambert_Wm1_e :: Double -> Ptr () -> IO CInt
-
-lambert_Wm1 :: Double -> Double
-lambert_Wm1 = gsl_sf_lambert_Wm1
-foreign import ccall "gsl_sf_lambert_Wm1" gsl_sf_lambert_Wm1 :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Legendre.hs b/lib/Numeric/GSL/Special/Legendre.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Legendre.hs
+++ /dev/null
@@ -1,233 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Legendre
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_legendre.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Legendre(
-  legendre_Pl_e
-, legendre_Pl
-, legendre_P1_e
-, legendre_P2_e
-, legendre_P3_e
-, legendre_P1
-, legendre_P2
-, legendre_P3
-, legendre_Q0_e
-, legendre_Q0
-, legendre_Q1_e
-, legendre_Q1
-, legendre_Ql_e
-, legendre_Ql
-, legendre_Plm_e
-, legendre_Plm
-, legendre_sphPlm_e
-, legendre_sphPlm
-, legendre_array_size
-, conicalP_half_e
-, conicalP_half
-, conicalP_mhalf_e
-, conicalP_mhalf
-, conicalP_0_e
-, conicalP_0
-, conicalP_1_e
-, conicalP_1
-, conicalP_sph_reg_e
-, conicalP_sph_reg
-, conicalP_cyl_reg_e
-, conicalP_cyl_reg
-, legendre_H3d_0_e
-, legendre_H3d_0
-, legendre_H3d_1_e
-, legendre_H3d_1
-, legendre_H3d_e
-, legendre_H3d
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-legendre_Pl_e :: CInt -> Double -> (Double,Double)
-legendre_Pl_e l x = createSFR "legendre_Pl_e" $ gsl_sf_legendre_Pl_e l x
-foreign import ccall "gsl_sf_legendre_Pl_e" gsl_sf_legendre_Pl_e :: CInt -> Double -> Ptr () -> IO CInt
-
-legendre_Pl :: CInt -> Double -> Double
-legendre_Pl = gsl_sf_legendre_Pl
-foreign import ccall "gsl_sf_legendre_Pl" gsl_sf_legendre_Pl :: CInt -> Double -> Double
-
-legendre_Pl_array :: CInt -> Double -> Ptr Double -> CInt
-legendre_Pl_array = gsl_sf_legendre_Pl_array
-foreign import ccall "gsl_sf_legendre_Pl_array" gsl_sf_legendre_Pl_array :: CInt -> Double -> Ptr Double -> CInt
-
-legendre_Pl_deriv_array :: CInt -> Double -> Ptr Double -> Ptr Double -> CInt
-legendre_Pl_deriv_array = gsl_sf_legendre_Pl_deriv_array
-foreign import ccall "gsl_sf_legendre_Pl_deriv_array" gsl_sf_legendre_Pl_deriv_array :: CInt -> Double -> Ptr Double -> Ptr Double -> CInt
-
-legendre_P1_e :: Double -> (Double,Double)
-legendre_P1_e x = createSFR "legendre_P1_e" $ gsl_sf_legendre_P1_e x
-foreign import ccall "gsl_sf_legendre_P1_e" gsl_sf_legendre_P1_e :: Double -> Ptr () -> IO CInt
-
-legendre_P2_e :: Double -> (Double,Double)
-legendre_P2_e x = createSFR "legendre_P2_e" $ gsl_sf_legendre_P2_e x
-foreign import ccall "gsl_sf_legendre_P2_e" gsl_sf_legendre_P2_e :: Double -> Ptr () -> IO CInt
-
-legendre_P3_e :: Double -> (Double,Double)
-legendre_P3_e x = createSFR "legendre_P3_e" $ gsl_sf_legendre_P3_e x
-foreign import ccall "gsl_sf_legendre_P3_e" gsl_sf_legendre_P3_e :: Double -> Ptr () -> IO CInt
-
-legendre_P1 :: Double -> Double
-legendre_P1 = gsl_sf_legendre_P1
-foreign import ccall "gsl_sf_legendre_P1" gsl_sf_legendre_P1 :: Double -> Double
-
-legendre_P2 :: Double -> Double
-legendre_P2 = gsl_sf_legendre_P2
-foreign import ccall "gsl_sf_legendre_P2" gsl_sf_legendre_P2 :: Double -> Double
-
-legendre_P3 :: Double -> Double
-legendre_P3 = gsl_sf_legendre_P3
-foreign import ccall "gsl_sf_legendre_P3" gsl_sf_legendre_P3 :: Double -> Double
-
-legendre_Q0_e :: Double -> (Double,Double)
-legendre_Q0_e x = createSFR "legendre_Q0_e" $ gsl_sf_legendre_Q0_e x
-foreign import ccall "gsl_sf_legendre_Q0_e" gsl_sf_legendre_Q0_e :: Double -> Ptr () -> IO CInt
-
-legendre_Q0 :: Double -> Double
-legendre_Q0 = gsl_sf_legendre_Q0
-foreign import ccall "gsl_sf_legendre_Q0" gsl_sf_legendre_Q0 :: Double -> Double
-
-legendre_Q1_e :: Double -> (Double,Double)
-legendre_Q1_e x = createSFR "legendre_Q1_e" $ gsl_sf_legendre_Q1_e x
-foreign import ccall "gsl_sf_legendre_Q1_e" gsl_sf_legendre_Q1_e :: Double -> Ptr () -> IO CInt
-
-legendre_Q1 :: Double -> Double
-legendre_Q1 = gsl_sf_legendre_Q1
-foreign import ccall "gsl_sf_legendre_Q1" gsl_sf_legendre_Q1 :: Double -> Double
-
-legendre_Ql_e :: CInt -> Double -> (Double,Double)
-legendre_Ql_e l x = createSFR "legendre_Ql_e" $ gsl_sf_legendre_Ql_e l x
-foreign import ccall "gsl_sf_legendre_Ql_e" gsl_sf_legendre_Ql_e :: CInt -> Double -> Ptr () -> IO CInt
-
-legendre_Ql :: CInt -> Double -> Double
-legendre_Ql = gsl_sf_legendre_Ql
-foreign import ccall "gsl_sf_legendre_Ql" gsl_sf_legendre_Ql :: CInt -> Double -> Double
-
-legendre_Plm_e :: CInt -> CInt -> Double -> (Double,Double)
-legendre_Plm_e l m x = createSFR "legendre_Plm_e" $ gsl_sf_legendre_Plm_e l m x
-foreign import ccall "gsl_sf_legendre_Plm_e" gsl_sf_legendre_Plm_e :: CInt -> CInt -> Double -> Ptr () -> IO CInt
-
-legendre_Plm :: CInt -> CInt -> Double -> Double
-legendre_Plm = gsl_sf_legendre_Plm
-foreign import ccall "gsl_sf_legendre_Plm" gsl_sf_legendre_Plm :: CInt -> CInt -> Double -> Double
-
-legendre_Plm_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-legendre_Plm_array = gsl_sf_legendre_Plm_array
-foreign import ccall "gsl_sf_legendre_Plm_array" gsl_sf_legendre_Plm_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-legendre_Plm_deriv_array :: CInt -> CInt -> Double -> Ptr Double -> Ptr Double -> CInt
-legendre_Plm_deriv_array = gsl_sf_legendre_Plm_deriv_array
-foreign import ccall "gsl_sf_legendre_Plm_deriv_array" gsl_sf_legendre_Plm_deriv_array :: CInt -> CInt -> Double -> Ptr Double -> Ptr Double -> CInt
-
-legendre_sphPlm_e :: CInt -> CInt -> Double -> (Double,Double)
-legendre_sphPlm_e l m x = createSFR "legendre_sphPlm_e" $ gsl_sf_legendre_sphPlm_e l m x
-foreign import ccall "gsl_sf_legendre_sphPlm_e" gsl_sf_legendre_sphPlm_e :: CInt -> CInt -> Double -> Ptr () -> IO CInt
-
-legendre_sphPlm :: CInt -> CInt -> Double -> Double
-legendre_sphPlm = gsl_sf_legendre_sphPlm
-foreign import ccall "gsl_sf_legendre_sphPlm" gsl_sf_legendre_sphPlm :: CInt -> CInt -> Double -> Double
-
-legendre_sphPlm_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-legendre_sphPlm_array = gsl_sf_legendre_sphPlm_array
-foreign import ccall "gsl_sf_legendre_sphPlm_array" gsl_sf_legendre_sphPlm_array :: CInt -> CInt -> Double -> Ptr Double -> CInt
-
-legendre_sphPlm_deriv_array :: CInt -> CInt -> Double -> Ptr Double -> Ptr Double -> CInt
-legendre_sphPlm_deriv_array = gsl_sf_legendre_sphPlm_deriv_array
-foreign import ccall "gsl_sf_legendre_sphPlm_deriv_array" gsl_sf_legendre_sphPlm_deriv_array :: CInt -> CInt -> Double -> Ptr Double -> Ptr Double -> CInt
-
-legendre_array_size :: CInt -> CInt -> CInt
-legendre_array_size = gsl_sf_legendre_array_size
-foreign import ccall "gsl_sf_legendre_array_size" gsl_sf_legendre_array_size :: CInt -> CInt -> CInt
-
-conicalP_half_e :: Double -> Double -> (Double,Double)
-conicalP_half_e lambda x = createSFR "conicalP_half_e" $ gsl_sf_conicalP_half_e lambda x
-foreign import ccall "gsl_sf_conicalP_half_e" gsl_sf_conicalP_half_e :: Double -> Double -> Ptr () -> IO CInt
-
-conicalP_half :: Double -> Double -> Double
-conicalP_half = gsl_sf_conicalP_half
-foreign import ccall "gsl_sf_conicalP_half" gsl_sf_conicalP_half :: Double -> Double -> Double
-
-conicalP_mhalf_e :: Double -> Double -> (Double,Double)
-conicalP_mhalf_e lambda x = createSFR "conicalP_mhalf_e" $ gsl_sf_conicalP_mhalf_e lambda x
-foreign import ccall "gsl_sf_conicalP_mhalf_e" gsl_sf_conicalP_mhalf_e :: Double -> Double -> Ptr () -> IO CInt
-
-conicalP_mhalf :: Double -> Double -> Double
-conicalP_mhalf = gsl_sf_conicalP_mhalf
-foreign import ccall "gsl_sf_conicalP_mhalf" gsl_sf_conicalP_mhalf :: Double -> Double -> Double
-
-conicalP_0_e :: Double -> Double -> (Double,Double)
-conicalP_0_e lambda x = createSFR "conicalP_0_e" $ gsl_sf_conicalP_0_e lambda x
-foreign import ccall "gsl_sf_conicalP_0_e" gsl_sf_conicalP_0_e :: Double -> Double -> Ptr () -> IO CInt
-
-conicalP_0 :: Double -> Double -> Double
-conicalP_0 = gsl_sf_conicalP_0
-foreign import ccall "gsl_sf_conicalP_0" gsl_sf_conicalP_0 :: Double -> Double -> Double
-
-conicalP_1_e :: Double -> Double -> (Double,Double)
-conicalP_1_e lambda x = createSFR "conicalP_1_e" $ gsl_sf_conicalP_1_e lambda x
-foreign import ccall "gsl_sf_conicalP_1_e" gsl_sf_conicalP_1_e :: Double -> Double -> Ptr () -> IO CInt
-
-conicalP_1 :: Double -> Double -> Double
-conicalP_1 = gsl_sf_conicalP_1
-foreign import ccall "gsl_sf_conicalP_1" gsl_sf_conicalP_1 :: Double -> Double -> Double
-
-conicalP_sph_reg_e :: CInt -> Double -> Double -> (Double,Double)
-conicalP_sph_reg_e l lambda x = createSFR "conicalP_sph_reg_e" $ gsl_sf_conicalP_sph_reg_e l lambda x
-foreign import ccall "gsl_sf_conicalP_sph_reg_e" gsl_sf_conicalP_sph_reg_e :: CInt -> Double -> Double -> Ptr () -> IO CInt
-
-conicalP_sph_reg :: CInt -> Double -> Double -> Double
-conicalP_sph_reg = gsl_sf_conicalP_sph_reg
-foreign import ccall "gsl_sf_conicalP_sph_reg" gsl_sf_conicalP_sph_reg :: CInt -> Double -> Double -> Double
-
-conicalP_cyl_reg_e :: CInt -> Double -> Double -> (Double,Double)
-conicalP_cyl_reg_e m lambda x = createSFR "conicalP_cyl_reg_e" $ gsl_sf_conicalP_cyl_reg_e m lambda x
-foreign import ccall "gsl_sf_conicalP_cyl_reg_e" gsl_sf_conicalP_cyl_reg_e :: CInt -> Double -> Double -> Ptr () -> IO CInt
-
-conicalP_cyl_reg :: CInt -> Double -> Double -> Double
-conicalP_cyl_reg = gsl_sf_conicalP_cyl_reg
-foreign import ccall "gsl_sf_conicalP_cyl_reg" gsl_sf_conicalP_cyl_reg :: CInt -> Double -> Double -> Double
-
-legendre_H3d_0_e :: Double -> Double -> (Double,Double)
-legendre_H3d_0_e lambda eta = createSFR "legendre_H3d_0_e" $ gsl_sf_legendre_H3d_0_e lambda eta
-foreign import ccall "gsl_sf_legendre_H3d_0_e" gsl_sf_legendre_H3d_0_e :: Double -> Double -> Ptr () -> IO CInt
-
-legendre_H3d_0 :: Double -> Double -> Double
-legendre_H3d_0 = gsl_sf_legendre_H3d_0
-foreign import ccall "gsl_sf_legendre_H3d_0" gsl_sf_legendre_H3d_0 :: Double -> Double -> Double
-
-legendre_H3d_1_e :: Double -> Double -> (Double,Double)
-legendre_H3d_1_e lambda eta = createSFR "legendre_H3d_1_e" $ gsl_sf_legendre_H3d_1_e lambda eta
-foreign import ccall "gsl_sf_legendre_H3d_1_e" gsl_sf_legendre_H3d_1_e :: Double -> Double -> Ptr () -> IO CInt
-
-legendre_H3d_1 :: Double -> Double -> Double
-legendre_H3d_1 = gsl_sf_legendre_H3d_1
-foreign import ccall "gsl_sf_legendre_H3d_1" gsl_sf_legendre_H3d_1 :: Double -> Double -> Double
-
-legendre_H3d_e :: CInt -> Double -> Double -> (Double,Double)
-legendre_H3d_e l lambda eta = createSFR "legendre_H3d_e" $ gsl_sf_legendre_H3d_e l lambda eta
-foreign import ccall "gsl_sf_legendre_H3d_e" gsl_sf_legendre_H3d_e :: CInt -> Double -> Double -> Ptr () -> IO CInt
-
-legendre_H3d :: CInt -> Double -> Double -> Double
-legendre_H3d = gsl_sf_legendre_H3d
-foreign import ccall "gsl_sf_legendre_H3d" gsl_sf_legendre_H3d :: CInt -> Double -> Double -> Double
-
-legendre_H3d_array :: CInt -> Double -> Double -> Ptr Double -> CInt
-legendre_H3d_array = gsl_sf_legendre_H3d_array
-foreign import ccall "gsl_sf_legendre_H3d_array" gsl_sf_legendre_H3d_array :: CInt -> Double -> Double -> Ptr Double -> CInt
diff --git a/lib/Numeric/GSL/Special/Log.hs b/lib/Numeric/GSL/Special/Log.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Log.hs
+++ /dev/null
@@ -1,64 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Log
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_log.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Log(
-  log_e
-, Numeric.GSL.Special.Log.log
-, log_abs_e
-, log_abs
-, log_1plusx_e
-, log_1plusx
-, log_1plusx_mx_e
-, log_1plusx_mx
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-log_e :: Double -> (Double,Double)
-log_e x = createSFR "log_e" $ gsl_sf_log_e x
-foreign import ccall "gsl_sf_log_e" gsl_sf_log_e :: Double -> Ptr () -> IO CInt
-
-log :: Double -> Double
-log = gsl_sf_log
-foreign import ccall "gsl_sf_log" gsl_sf_log :: Double -> Double
-
-log_abs_e :: Double -> (Double,Double)
-log_abs_e x = createSFR "log_abs_e" $ gsl_sf_log_abs_e x
-foreign import ccall "gsl_sf_log_abs_e" gsl_sf_log_abs_e :: Double -> Ptr () -> IO CInt
-
-log_abs :: Double -> Double
-log_abs = gsl_sf_log_abs
-foreign import ccall "gsl_sf_log_abs" gsl_sf_log_abs :: Double -> Double
-
-complex_log_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_log_e zr zi lnr = createSFR "complex_log_e" $ gsl_sf_complex_log_e zr zi lnr
-foreign import ccall "gsl_sf_complex_log_e" gsl_sf_complex_log_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-log_1plusx_e :: Double -> (Double,Double)
-log_1plusx_e x = createSFR "log_1plusx_e" $ gsl_sf_log_1plusx_e x
-foreign import ccall "gsl_sf_log_1plusx_e" gsl_sf_log_1plusx_e :: Double -> Ptr () -> IO CInt
-
-log_1plusx :: Double -> Double
-log_1plusx = gsl_sf_log_1plusx
-foreign import ccall "gsl_sf_log_1plusx" gsl_sf_log_1plusx :: Double -> Double
-
-log_1plusx_mx_e :: Double -> (Double,Double)
-log_1plusx_mx_e x = createSFR "log_1plusx_mx_e" $ gsl_sf_log_1plusx_mx_e x
-foreign import ccall "gsl_sf_log_1plusx_mx_e" gsl_sf_log_1plusx_mx_e :: Double -> Ptr () -> IO CInt
-
-log_1plusx_mx :: Double -> Double
-log_1plusx_mx = gsl_sf_log_1plusx_mx
-foreign import ccall "gsl_sf_log_1plusx_mx" gsl_sf_log_1plusx_mx :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Pow_int.hs b/lib/Numeric/GSL/Special/Pow_int.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Pow_int.hs
+++ /dev/null
@@ -1,30 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Pow_int
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_pow_int.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Pow_int(
-  pow_int_e
-, pow_int
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-pow_int_e :: Double -> CInt -> (Double,Double)
-pow_int_e x n = createSFR "pow_int_e" $ gsl_sf_pow_int_e x n
-foreign import ccall "gsl_sf_pow_int_e" gsl_sf_pow_int_e :: Double -> CInt -> Ptr () -> IO CInt
-
-pow_int :: Double -> CInt -> Double
-pow_int = gsl_sf_pow_int
-foreign import ccall "gsl_sf_pow_int" gsl_sf_pow_int :: Double -> CInt -> Double
diff --git a/lib/Numeric/GSL/Special/Psi.hs b/lib/Numeric/GSL/Special/Psi.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Psi.hs
+++ /dev/null
@@ -1,84 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Psi
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_psi.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Psi(
-  psi_int_e
-, psi_int
-, psi_e
-, psi
-, psi_1piy_e
-, psi_1piy
-, psi_1_int_e
-, psi_1_int
-, psi_1_e
-, psi_1
-, psi_n_e
-, psi_n
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-psi_int_e :: CInt -> (Double,Double)
-psi_int_e n = createSFR "psi_int_e" $ gsl_sf_psi_int_e n
-foreign import ccall "gsl_sf_psi_int_e" gsl_sf_psi_int_e :: CInt -> Ptr () -> IO CInt
-
-psi_int :: CInt -> Double
-psi_int = gsl_sf_psi_int
-foreign import ccall "gsl_sf_psi_int" gsl_sf_psi_int :: CInt -> Double
-
-psi_e :: Double -> (Double,Double)
-psi_e x = createSFR "psi_e" $ gsl_sf_psi_e x
-foreign import ccall "gsl_sf_psi_e" gsl_sf_psi_e :: Double -> Ptr () -> IO CInt
-
-psi :: Double -> Double
-psi = gsl_sf_psi
-foreign import ccall "gsl_sf_psi" gsl_sf_psi :: Double -> Double
-
-psi_1piy_e :: Double -> (Double,Double)
-psi_1piy_e y = createSFR "psi_1piy_e" $ gsl_sf_psi_1piy_e y
-foreign import ccall "gsl_sf_psi_1piy_e" gsl_sf_psi_1piy_e :: Double -> Ptr () -> IO CInt
-
-psi_1piy :: Double -> Double
-psi_1piy = gsl_sf_psi_1piy
-foreign import ccall "gsl_sf_psi_1piy" gsl_sf_psi_1piy :: Double -> Double
-
-complex_psi_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_psi_e x y result_re = createSFR "complex_psi_e" $ gsl_sf_complex_psi_e x y result_re
-foreign import ccall "gsl_sf_complex_psi_e" gsl_sf_complex_psi_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-psi_1_int_e :: CInt -> (Double,Double)
-psi_1_int_e n = createSFR "psi_1_int_e" $ gsl_sf_psi_1_int_e n
-foreign import ccall "gsl_sf_psi_1_int_e" gsl_sf_psi_1_int_e :: CInt -> Ptr () -> IO CInt
-
-psi_1_int :: CInt -> Double
-psi_1_int = gsl_sf_psi_1_int
-foreign import ccall "gsl_sf_psi_1_int" gsl_sf_psi_1_int :: CInt -> Double
-
-psi_1_e :: Double -> (Double,Double)
-psi_1_e x = createSFR "psi_1_e" $ gsl_sf_psi_1_e x
-foreign import ccall "gsl_sf_psi_1_e" gsl_sf_psi_1_e :: Double -> Ptr () -> IO CInt
-
-psi_1 :: Double -> Double
-psi_1 = gsl_sf_psi_1
-foreign import ccall "gsl_sf_psi_1" gsl_sf_psi_1 :: Double -> Double
-
-psi_n_e :: CInt -> Double -> (Double,Double)
-psi_n_e n x = createSFR "psi_n_e" $ gsl_sf_psi_n_e n x
-foreign import ccall "gsl_sf_psi_n_e" gsl_sf_psi_n_e :: CInt -> Double -> Ptr () -> IO CInt
-
-psi_n :: CInt -> Double -> Double
-psi_n = gsl_sf_psi_n
-foreign import ccall "gsl_sf_psi_n" gsl_sf_psi_n :: CInt -> Double -> Double
diff --git a/lib/Numeric/GSL/Special/Synchrotron.hs b/lib/Numeric/GSL/Special/Synchrotron.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Synchrotron.hs
+++ /dev/null
@@ -1,40 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Synchrotron
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_synchrotron.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Synchrotron(
-  synchrotron_1_e
-, synchrotron_1
-, synchrotron_2_e
-, synchrotron_2
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-synchrotron_1_e :: Double -> (Double,Double)
-synchrotron_1_e x = createSFR "synchrotron_1_e" $ gsl_sf_synchrotron_1_e x
-foreign import ccall "gsl_sf_synchrotron_1_e" gsl_sf_synchrotron_1_e :: Double -> Ptr () -> IO CInt
-
-synchrotron_1 :: Double -> Double
-synchrotron_1 = gsl_sf_synchrotron_1
-foreign import ccall "gsl_sf_synchrotron_1" gsl_sf_synchrotron_1 :: Double -> Double
-
-synchrotron_2_e :: Double -> (Double,Double)
-synchrotron_2_e x = createSFR "synchrotron_2_e" $ gsl_sf_synchrotron_2_e x
-foreign import ccall "gsl_sf_synchrotron_2_e" gsl_sf_synchrotron_2_e :: Double -> Ptr () -> IO CInt
-
-synchrotron_2 :: Double -> Double
-synchrotron_2 = gsl_sf_synchrotron_2
-foreign import ccall "gsl_sf_synchrotron_2" gsl_sf_synchrotron_2 :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Transport.hs b/lib/Numeric/GSL/Special/Transport.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Transport.hs
+++ /dev/null
@@ -1,60 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Transport
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_transport.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Transport(
-  transport_2_e
-, transport_2
-, transport_3_e
-, transport_3
-, transport_4_e
-, transport_4
-, transport_5_e
-, transport_5
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-transport_2_e :: Double -> (Double,Double)
-transport_2_e x = createSFR "transport_2_e" $ gsl_sf_transport_2_e x
-foreign import ccall "gsl_sf_transport_2_e" gsl_sf_transport_2_e :: Double -> Ptr () -> IO CInt
-
-transport_2 :: Double -> Double
-transport_2 = gsl_sf_transport_2
-foreign import ccall "gsl_sf_transport_2" gsl_sf_transport_2 :: Double -> Double
-
-transport_3_e :: Double -> (Double,Double)
-transport_3_e x = createSFR "transport_3_e" $ gsl_sf_transport_3_e x
-foreign import ccall "gsl_sf_transport_3_e" gsl_sf_transport_3_e :: Double -> Ptr () -> IO CInt
-
-transport_3 :: Double -> Double
-transport_3 = gsl_sf_transport_3
-foreign import ccall "gsl_sf_transport_3" gsl_sf_transport_3 :: Double -> Double
-
-transport_4_e :: Double -> (Double,Double)
-transport_4_e x = createSFR "transport_4_e" $ gsl_sf_transport_4_e x
-foreign import ccall "gsl_sf_transport_4_e" gsl_sf_transport_4_e :: Double -> Ptr () -> IO CInt
-
-transport_4 :: Double -> Double
-transport_4 = gsl_sf_transport_4
-foreign import ccall "gsl_sf_transport_4" gsl_sf_transport_4 :: Double -> Double
-
-transport_5_e :: Double -> (Double,Double)
-transport_5_e x = createSFR "transport_5_e" $ gsl_sf_transport_5_e x
-foreign import ccall "gsl_sf_transport_5_e" gsl_sf_transport_5_e :: Double -> Ptr () -> IO CInt
-
-transport_5 :: Double -> Double
-transport_5 = gsl_sf_transport_5
-foreign import ccall "gsl_sf_transport_5" gsl_sf_transport_5 :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/Trig.hs b/lib/Numeric/GSL/Special/Trig.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Trig.hs
+++ /dev/null
@@ -1,138 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Trig
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_trig.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Trig(
-  sin_e
-, Numeric.GSL.Special.Trig.sin
-, cos_e
-, Numeric.GSL.Special.Trig.cos
-, hypot_e
-, hypot
-, sinc_e
-, sinc
-, lnsinh_e
-, lnsinh
-, lncosh_e
-, lncosh
-, sin_err_e
-, cos_err_e
-, angle_restrict_symm
-, angle_restrict_pos
-, angle_restrict_symm_err_e
-, angle_restrict_pos_err_e
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-sin_e :: Double -> (Double,Double)
-sin_e x = createSFR "sin_e" $ gsl_sf_sin_e x
-foreign import ccall "gsl_sf_sin_e" gsl_sf_sin_e :: Double -> Ptr () -> IO CInt
-
-sin :: Double -> Double
-sin = gsl_sf_sin
-foreign import ccall "gsl_sf_sin" gsl_sf_sin :: Double -> Double
-
-cos_e :: Double -> (Double,Double)
-cos_e x = createSFR "cos_e" $ gsl_sf_cos_e x
-foreign import ccall "gsl_sf_cos_e" gsl_sf_cos_e :: Double -> Ptr () -> IO CInt
-
-cos :: Double -> Double
-cos = gsl_sf_cos
-foreign import ccall "gsl_sf_cos" gsl_sf_cos :: Double -> Double
-
-hypot_e :: Double -> Double -> (Double,Double)
-hypot_e x y = createSFR "hypot_e" $ gsl_sf_hypot_e x y
-foreign import ccall "gsl_sf_hypot_e" gsl_sf_hypot_e :: Double -> Double -> Ptr () -> IO CInt
-
-hypot :: Double -> Double -> Double
-hypot = gsl_sf_hypot
-foreign import ccall "gsl_sf_hypot" gsl_sf_hypot :: Double -> Double -> Double
-
-complex_sin_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_sin_e zr zi szr = createSFR "complex_sin_e" $ gsl_sf_complex_sin_e zr zi szr
-foreign import ccall "gsl_sf_complex_sin_e" gsl_sf_complex_sin_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-complex_cos_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_cos_e zr zi czr = createSFR "complex_cos_e" $ gsl_sf_complex_cos_e zr zi czr
-foreign import ccall "gsl_sf_complex_cos_e" gsl_sf_complex_cos_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-complex_logsin_e :: Double -> Double -> Ptr () -> (Double,Double)
-complex_logsin_e zr zi lszr = createSFR "complex_logsin_e" $ gsl_sf_complex_logsin_e zr zi lszr
-foreign import ccall "gsl_sf_complex_logsin_e" gsl_sf_complex_logsin_e :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-sinc_e :: Double -> (Double,Double)
-sinc_e x = createSFR "sinc_e" $ gsl_sf_sinc_e x
-foreign import ccall "gsl_sf_sinc_e" gsl_sf_sinc_e :: Double -> Ptr () -> IO CInt
-
-sinc :: Double -> Double
-sinc = gsl_sf_sinc
-foreign import ccall "gsl_sf_sinc" gsl_sf_sinc :: Double -> Double
-
-lnsinh_e :: Double -> (Double,Double)
-lnsinh_e x = createSFR "lnsinh_e" $ gsl_sf_lnsinh_e x
-foreign import ccall "gsl_sf_lnsinh_e" gsl_sf_lnsinh_e :: Double -> Ptr () -> IO CInt
-
-lnsinh :: Double -> Double
-lnsinh = gsl_sf_lnsinh
-foreign import ccall "gsl_sf_lnsinh" gsl_sf_lnsinh :: Double -> Double
-
-lncosh_e :: Double -> (Double,Double)
-lncosh_e x = createSFR "lncosh_e" $ gsl_sf_lncosh_e x
-foreign import ccall "gsl_sf_lncosh_e" gsl_sf_lncosh_e :: Double -> Ptr () -> IO CInt
-
-lncosh :: Double -> Double
-lncosh = gsl_sf_lncosh
-foreign import ccall "gsl_sf_lncosh" gsl_sf_lncosh :: Double -> Double
-
-polar_to_rect :: Double -> Double -> Ptr () -> (Double,Double)
-polar_to_rect r theta x = createSFR "polar_to_rect" $ gsl_sf_polar_to_rect r theta x
-foreign import ccall "gsl_sf_polar_to_rect" gsl_sf_polar_to_rect :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-rect_to_polar :: Double -> Double -> Ptr () -> (Double,Double)
-rect_to_polar x y r = createSFR "rect_to_polar" $ gsl_sf_rect_to_polar x y r
-foreign import ccall "gsl_sf_rect_to_polar" gsl_sf_rect_to_polar :: Double -> Double -> Ptr () -> Ptr () -> IO CInt
-
-sin_err_e :: Double -> Double -> (Double,Double)
-sin_err_e x dx = createSFR "sin_err_e" $ gsl_sf_sin_err_e x dx
-foreign import ccall "gsl_sf_sin_err_e" gsl_sf_sin_err_e :: Double -> Double -> Ptr () -> IO CInt
-
-cos_err_e :: Double -> Double -> (Double,Double)
-cos_err_e x dx = createSFR "cos_err_e" $ gsl_sf_cos_err_e x dx
-foreign import ccall "gsl_sf_cos_err_e" gsl_sf_cos_err_e :: Double -> Double -> Ptr () -> IO CInt
-
-angle_restrict_symm_e :: Ptr Double -> CInt
-angle_restrict_symm_e = gsl_sf_angle_restrict_symm_e
-foreign import ccall "gsl_sf_angle_restrict_symm_e" gsl_sf_angle_restrict_symm_e :: Ptr Double -> CInt
-
-angle_restrict_symm :: Double -> Double
-angle_restrict_symm = gsl_sf_angle_restrict_symm
-foreign import ccall "gsl_sf_angle_restrict_symm" gsl_sf_angle_restrict_symm :: Double -> Double
-
-angle_restrict_pos_e :: Ptr Double -> CInt
-angle_restrict_pos_e = gsl_sf_angle_restrict_pos_e
-foreign import ccall "gsl_sf_angle_restrict_pos_e" gsl_sf_angle_restrict_pos_e :: Ptr Double -> CInt
-
-angle_restrict_pos :: Double -> Double
-angle_restrict_pos = gsl_sf_angle_restrict_pos
-foreign import ccall "gsl_sf_angle_restrict_pos" gsl_sf_angle_restrict_pos :: Double -> Double
-
-angle_restrict_symm_err_e :: Double -> (Double,Double)
-angle_restrict_symm_err_e theta = createSFR "angle_restrict_symm_err_e" $ gsl_sf_angle_restrict_symm_err_e theta
-foreign import ccall "gsl_sf_angle_restrict_symm_err_e" gsl_sf_angle_restrict_symm_err_e :: Double -> Ptr () -> IO CInt
-
-angle_restrict_pos_err_e :: Double -> (Double,Double)
-angle_restrict_pos_err_e theta = createSFR "angle_restrict_pos_err_e" $ gsl_sf_angle_restrict_pos_err_e theta
-foreign import ccall "gsl_sf_angle_restrict_pos_err_e" gsl_sf_angle_restrict_pos_err_e :: Double -> Ptr () -> IO CInt
diff --git a/lib/Numeric/GSL/Special/Zeta.hs b/lib/Numeric/GSL/Special/Zeta.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/Zeta.hs
+++ /dev/null
@@ -1,90 +0,0 @@
-------------------------------------------------------------
--- |
--- Module      :  Numeric.GSL.Special.Zeta
--- Copyright   :  (c) Alberto Ruiz 2006
--- License     :  GPL
--- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
--- Stability   :  provisional
--- Portability :  uses ffi
---
--- Wrappers for selected functions described at:
---
--- <http://www.google.com/search?q=gsl_sf_zeta.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
-------------------------------------------------------------
-
-module Numeric.GSL.Special.Zeta(
-  zeta_int_e
-, zeta_int
-, zeta_e
-, zeta
-, zetam1_e
-, zetam1
-, zetam1_int_e
-, zetam1_int
-, hzeta_e
-, hzeta
-, eta_int_e
-, eta_int
-, eta_e
-, eta
-) where
-
-import Foreign(Ptr)
-import Foreign.C.Types(CInt)
-import Numeric.GSL.Special.Internal
-
-zeta_int_e :: CInt -> (Double,Double)
-zeta_int_e n = createSFR "zeta_int_e" $ gsl_sf_zeta_int_e n
-foreign import ccall "gsl_sf_zeta_int_e" gsl_sf_zeta_int_e :: CInt -> Ptr () -> IO CInt
-
-zeta_int :: CInt -> Double
-zeta_int = gsl_sf_zeta_int
-foreign import ccall "gsl_sf_zeta_int" gsl_sf_zeta_int :: CInt -> Double
-
-zeta_e :: Double -> (Double,Double)
-zeta_e s = createSFR "zeta_e" $ gsl_sf_zeta_e s
-foreign import ccall "gsl_sf_zeta_e" gsl_sf_zeta_e :: Double -> Ptr () -> IO CInt
-
-zeta :: Double -> Double
-zeta = gsl_sf_zeta
-foreign import ccall "gsl_sf_zeta" gsl_sf_zeta :: Double -> Double
-
-zetam1_e :: Double -> (Double,Double)
-zetam1_e s = createSFR "zetam1_e" $ gsl_sf_zetam1_e s
-foreign import ccall "gsl_sf_zetam1_e" gsl_sf_zetam1_e :: Double -> Ptr () -> IO CInt
-
-zetam1 :: Double -> Double
-zetam1 = gsl_sf_zetam1
-foreign import ccall "gsl_sf_zetam1" gsl_sf_zetam1 :: Double -> Double
-
-zetam1_int_e :: CInt -> (Double,Double)
-zetam1_int_e s = createSFR "zetam1_int_e" $ gsl_sf_zetam1_int_e s
-foreign import ccall "gsl_sf_zetam1_int_e" gsl_sf_zetam1_int_e :: CInt -> Ptr () -> IO CInt
-
-zetam1_int :: CInt -> Double
-zetam1_int = gsl_sf_zetam1_int
-foreign import ccall "gsl_sf_zetam1_int" gsl_sf_zetam1_int :: CInt -> Double
-
-hzeta_e :: Double -> Double -> (Double,Double)
-hzeta_e s q = createSFR "hzeta_e" $ gsl_sf_hzeta_e s q
-foreign import ccall "gsl_sf_hzeta_e" gsl_sf_hzeta_e :: Double -> Double -> Ptr () -> IO CInt
-
-hzeta :: Double -> Double -> Double
-hzeta = gsl_sf_hzeta
-foreign import ccall "gsl_sf_hzeta" gsl_sf_hzeta :: Double -> Double -> Double
-
-eta_int_e :: CInt -> (Double,Double)
-eta_int_e n = createSFR "eta_int_e" $ gsl_sf_eta_int_e n
-foreign import ccall "gsl_sf_eta_int_e" gsl_sf_eta_int_e :: CInt -> Ptr () -> IO CInt
-
-eta_int :: CInt -> Double
-eta_int = gsl_sf_eta_int
-foreign import ccall "gsl_sf_eta_int" gsl_sf_eta_int :: CInt -> Double
-
-eta_e :: Double -> (Double,Double)
-eta_e s = createSFR "eta_e" $ gsl_sf_eta_e s
-foreign import ccall "gsl_sf_eta_e" gsl_sf_eta_e :: Double -> Ptr () -> IO CInt
-
-eta :: Double -> Double
-eta = gsl_sf_eta
-foreign import ccall "gsl_sf_eta" gsl_sf_eta :: Double -> Double
diff --git a/lib/Numeric/GSL/Special/auto.hs b/lib/Numeric/GSL/Special/auto.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/auto.hs
+++ /dev/null
@@ -1,244 +0,0 @@
-#!/usr/bin/env runhaskell
-
--- automatic generation of wrappers for simple GSL special functions
-
-import Text.ParserCombinators.Parsec
-import System
-import Data.List(intersperse, isPrefixOf)
-import Data.Char(toUpper,isUpper,toLower)
-
-data Type = Normal Ident | Pointer Ident deriving (Eq, Show)
-
-type Ident = String
-
-data Header = Header Type Ident [(Type,Ident)] deriving Show
-
-headers f = case parse parseHeaders "" f of
-    Right l -> l
-    Left s -> error (show s)
-
-
-rep (c,r) [] = []
-rep (c,r) f@(x:xs) 
-  | c `isPrefixOf` f = r ++ rep (c,r) (drop (length c) f)
-  | otherwise        = x:(rep (c,r) xs)
-
-
-fixlong [] = []
-fixlong "\\" = []
-fixlong ('\\':'\n':xs) = xs
-fixlong (x:xs) = x : fixlong xs
-
-
-safe (Header _ _ args) =  all ok args 
-                         || all ok (init args) && kn (last args)
-    where ok ((Normal s),_) | s `elem` ["double","float","int","gsl_mode_t"] = True
-          ok _ = False
-          kn ((Pointer "gsl_sf_result"),_) = True
-          kn ((Pointer "gsl_sf_result_e10"),_) = True
-          kn _ = False
-
-
-
-fixC s = rep ("gsl_mode_t","int") $ rep ("gsl_sf_result","double") $ rep ("gsl_sf_result_e10","double") $ s
-
-main = do
-    args <- getArgs
-    let name = args!!0
-        headerfile =
-            case args of
-                [n] -> "/usr/include/gsl/gsl_sf_"++n++".h"
-                [_,f] -> f
-    file <- readFile headerfile
-
-    putStrLn headerfile
-    --mapM_ print (headers $ fixlong file)
-    let parsed = (headers $ fixlong file)
-    -- writeFile (name ++".h") (fixC $ unlines $ map showC parsed) 
-
-    --putStrLn ""
-    --mapM (\(Header _ n _) -> putStrLn (drop 7 n ++",")) parsed
-    --putStrLn ""
-    --mapM_ (putStrLn.showFull (name ++".h")) parsed
-    let exports = rep (")",") where") $ rep ("(\n","(\n  ") $ rep (",\n",", ") $ unlines $ ["("]++intersperse "," (map (\(Header _ n _) -> hName n) (filter safe parsed))++[")"]
-    let defs = unlines $ map (showFull (name ++".h")) parsed
-    let imports = "\nimport Foreign(Ptr)\n"
-                ++"import Foreign.C.Types(CInt)\n"
-                ++"import Numeric.GSL.Special.Internal\n"
-    let mod = modhead name ++ "module Numeric.GSL.Special."++ upperFirst name++exports++imports++defs
-    writeFile (upperFirst name ++ ".hs") mod
---     appendFile "funs.txt" $ rep ("(\n ","-- * "
---                                      ++map toUpper name
---                                 --   ++"\n"++google ( "gsl_sf_"++name++".h")++"\n"
---                                      ++"\n,") $ rep (") where","") $ exports
-
-
-google name = "<http://www.google.com/search?q="
-               ++name
-               ++"&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>"
-
-modhead name = replicate 60 '-' ++ "\n-- |\n"
-             ++"-- Module      :  Numeric.GSL.Special."++upperFirst name++"\n"
-             ++"-- Copyright   :  (c) Alberto Ruiz 2006\n"
-             ++"-- License     :  GPL\n"
-             ++"-- Maintainer  :  Alberto Ruiz (aruiz at um dot es)\n"
-             ++"-- Stability   :  provisional\n"
-             ++"-- Portability :  uses ffi\n"
-             ++"--\n"
-             ++"-- Wrappers for selected functions described at:\n--\n-- "
-             ++ google ( "gsl_sf_"++name++".h")++"\n"
-             ++ replicate 60 '-' ++ "\n\n"
-
-upperFirst (x:xs) = toUpper x : xs
-
-comment = do
-    string "/*"
-    closecomment
-    spaces
-    return "comment"
-
-closecomment = try (string "*/")
-               <|> (do anyChar
-                       closecomment)
-
-ident = do 
-    spaces
-    id <- many1 (noneOf "()[]* \n\t,;")
-    spaces
-    return id
-
-comment' = between (char '(') (char ')') (many $ noneOf ")") 
-
-
-define = do
-    string "#"
-    closedefine
-    spaces
-    return "define"
-
-closedefine = try (string "\n")
-              <|> (do anyChar
-                      closedefine)
-
-marks = do
-    try (string "__BEGIN_DECLS" >> spaces >> return "begin")
-    <|>
-    try (string "__END_DECLS" >> spaces >> return "end")
-
-
-
-irrelevant =
-    try comment
-    <|>
-    try define
-    <|>
-    marks
-
-
-parseHeaders = many parseHeader
-
-parseHeader = do
-    spaces
-    many irrelevant
-    spaces
-    (res,name)  <- typ
-    spaces
-    args <- between (char '(') (char ')') (sepBy typ (char ','))
-    spaces
-    char ';'
-    spaces
-    many irrelevant
-    return $ Header res name args
-
-typ = try t1 <|> t2
-
-symbol s = spaces >> string s >> spaces
-
-t1 = do
-    t <- try (symbol "const" >> symbol "unsigned" >> ident) -- aaagh 
-         <|>
-         try (symbol "const" >> ident)
-         <|>
-         try (symbol "unsigned" >> ident)
-         <|> ident
-    n <- ident
-    return (Normal t,n)
-
-t2 = do
-    t <- ident
-    spaces
-    char '*'
-    spaces
-    n <- ident
-    return (Pointer t,n)
-
-pure (Header _ _ args) | fst (last args) == Pointer "gsl_sf_result" = False
-                       | fst (last args) == Pointer "gsl_sf_result_e10" = False
-                       | otherwise = True
-
-showC (Header t n args) = showCt t ++ " " ++ n ++ "("  ++ (concat $ intersperse "," $ map showCa args) ++ ");"
-
-showCt (Normal s) = s
-showCt (Pointer s) = s ++ "*"
-
-showCa (t, a) = showCt t ++" "++ a
-
-showH hc h@(Header t n args) = "foreign import ccall \""++n++"\" "++n++" :: "++ (concat$intersperse" -> "$map showHa args) ++" -> " ++ t'
-    where t' | pure h = showHt t
-             | otherwise = "IO "++showHt t
-
-ht "int" = "CInt"
-ht (s:ss) = toUpper s : ss
-
-showHt (Normal t) = ht t
-showHt (Pointer "gsl_sf_result") = "Ptr ()"
-showHt (Pointer "gsl_sf_result_e10") = "Ptr ()"
-showHt (Pointer t) = "Ptr "++ht t
-
-showHa (t,a) = showHt t
-
-showFull hc h@(Header t n args) = -- "\n-- | wrapper for "++showC h
-                                  --   ++"\n--\n--   "++google n ++"\n"++
-                                  -- ++ "\n" ++
-                                  "\n" ++ boiler h ++ 
-                                  "\n" ++ showH hc h
-
-fixmd1 = rep ("Gsl_mode_t","Precision")
-fixmd2 = rep ("mode"," (precCode mode)")
-
-boiler h@(Header t n args) | fst (last args) == Pointer "gsl_sf_result" = boilerResult h
-                           | fst (last args) == Pointer "gsl_sf_result_e10" = boilerResultE10 h
-                           | any isMode args = boilerMode h
-                           | otherwise = boilerBasic h
-
-isMode (Normal "gsl_mode_t",_) = True
-isMode _ = False
-
-hName n = f $ drop 7 n
-    where f (s:ss) = toLower s : ss
-
-
-boilerResult h@(Header t n args) =
-    hName n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$ map showHa (init args)) ++" -> " ++ "(Double,Double)\n" ++
-     hName n ++ " "++ initArgs args ++
-       " = createSFR \""++ hName n ++"\" $ " ++ n ++ " "++ (fixmd2 $ initArgs args)
-
-boilerResultE10 h@(Header t n args) =
-    hName n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$ map showHa (init args)) ++" -> " ++ "(Double,Int,Double)\n" ++
-     hName n ++ " "++ initArgs args ++
-       " = createSFR_E10 \""++ hName n ++"\" $ " ++ n ++ " "++ (fixmd2 $ initArgs args)
-
-boilerBasic h@(Header t n args) = 
-    hName n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$map showHa args) ++" -> " ++showHt t ++ "\n" ++
-      hName n ++ " = " ++fixmd2 n
-
-boilerMode h@(Header t n args) =
-    hName n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$ map showHa args) ++" -> " ++ showHt t++"\n" ++
-     hName n ++ " "++ allArgs args ++
-       " = " ++ n ++ " "++ (fixmd2 $ allArgs args)
-
-cVar (v:vs) | isUpper v = toLower v : v : vs
-            | otherwise = v:vs
-
-allArgs args =  unwords (map (cVar.snd) args)
-initArgs args = unwords (map (cVar.snd) (init args))
diff --git a/lib/Numeric/GSL/Special/autoall.sh b/lib/Numeric/GSL/Special/autoall.sh
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/autoall.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-
-function rep {
-    ./replace.hs "$1" "$2" < $3 > /tmp/tmp-rep
-    cp /tmp/tmp-rep $3
-}
-
-rm -f funs.txt
-
-./auto.hs airy
-rep ') where' ', Precision(..)\n) where' Airy.hs
-./auto.hs bessel
-./auto.hs clausen
-./auto.hs coulomb
-./auto.hs coupling
-rep ', coupling_6j_INCORRECT_e\n, coupling_6j_INCORRECT\n' '' Coupling.hs
-./auto.hs dawson
-./auto.hs debye
-./auto.hs dilog
-./auto.hs elementary
-./auto.hs ellint
-#./auto.hs elljac
-./auto.hs erf
-./auto.hs exp
-rep ', exp\n' ', Numeric.GSL.Special.Exp.exp\n' Exp.hs
-rep ', exprel_n_CF_e' '-- , exprel_n_CF_e' Exp.hs
-./auto.hs expint
-./auto.hs fermi_dirac
-./auto.hs gamma
-./auto.hs gegenbauer
-./auto.hs hyperg
-./auto.hs laguerre
-./auto.hs lambert
-./auto.hs legendre
-./auto.hs log
-rep ', log\n' ', Numeric.GSL.Special.Log.log\n' Log.hs
-#./auto.hs mathieu
-./auto.hs pow_int
-./auto.hs psi
-./auto.hs synchrotron
-./auto.hs transport
-./auto.hs trig
-rep ', sin\n' ', Numeric.GSL.Special.Trig.sin\n' Trig.hs
-rep ', cos\n' ', Numeric.GSL.Special.Trig.cos\n' Trig.hs
-./auto.hs zeta
diff --git a/lib/Numeric/GSL/Special/replace.hs b/lib/Numeric/GSL/Special/replace.hs
deleted file mode 100644
--- a/lib/Numeric/GSL/Special/replace.hs
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env runhaskell
-
-import Data.List(isPrefixOf)
-import System(getArgs)
-
-rep (c,r) [] = []
-rep (c,r) f@(x:xs) 
-  | c `isPrefixOf` f = r ++ rep (c,r) (drop (length c) f)
-  | otherwise        = x:(rep (c,r) xs)
-
-main = do
-    args <- getArgs
-    let [p',r'] = map (rep ("\\n","\n")) args
-    interact $ rep (p',r')
diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs
--- a/lib/Numeric/GSL/Vector.hs
+++ b/lib/Numeric/GSL/Vector.hs
@@ -25,7 +25,7 @@
 import Data.Packed.Internal.Signatures
 import Data.Packed.Internal.Vector
 
-import Complex
+import Data.Complex
 import Foreign
 import Foreign.C.Types(CInt)
 
diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c
--- a/lib/Numeric/GSL/gsl-aux.c
+++ b/lib/Numeric/GSL/gsl-aux.c
@@ -23,6 +23,7 @@
 #include <gsl/gsl_rng.h>
 #include <gsl/gsl_randist.h>
 #include <gsl/gsl_odeiv.h>
+#include <gsl/gsl_multifit_nlin.h>
 #include <string.h>
 #include <stdio.h>
 
@@ -668,9 +669,10 @@
 
 // working with the jacobian
 
-typedef struct {int (*f)(int, double*, int, double *); int (*jf)(int, double*, int, int, double*);} Tfjf;
+typedef struct {int (*f)(int, double*, int, double *);
+                int (*jf)(int, double*, int, int, double*);} Tfjf;
 
-int f_aux_root(const gsl_vector*x, void *pars, gsl_vector*y) {
+int f_aux(const gsl_vector*x, void *pars, gsl_vector*y) {
     Tfjf * fjf = ((Tfjf*) pars);
     double* p = (double*)calloc(x->size,sizeof(double));
     double* q = (double*)calloc(y->size,sizeof(double));
@@ -687,20 +689,20 @@
     return 0;
 }
 
-int jf_aux_root(const gsl_vector * x, void * pars, gsl_matrix * jac) {
+int jf_aux(const gsl_vector * x, void * pars, gsl_matrix * jac) {
     Tfjf * fjf = ((Tfjf*) pars);
     double* p = (double*)calloc(x->size,sizeof(double));
-    double* q = (double*)calloc((x->size)*(x->size),sizeof(double));
+    double* q = (double*)calloc((jac->size1)*(jac->size2),sizeof(double));
     int i,j,k;
     for(k=0;k<x->size;k++) {
         p[k] = gsl_vector_get(x,k);
     }
 
-    (fjf->jf)(x->size,p,x->size,x->size,q);
+    (fjf->jf)(x->size,p,jac->size1,jac->size2,q);
 
     k=0;
-    for(i=0;i<x->size;i++) {
-        for(j=0;j<x->size;j++){
+    for(i=0;i<jac->size1;i++) {
+        for(j=0;j<jac->size2;j++){
             gsl_matrix_set(jac,i,j,q[k++]);
         }
     }
@@ -709,9 +711,9 @@
     return 0;
 }
 
-int fjf_aux_root(const gsl_vector * x, void * pars, gsl_vector * f, gsl_matrix * g) {
-    f_aux_root(x,pars,f);
-    jf_aux_root(x,pars,g);
+int fjf_aux(const gsl_vector * x, void * pars, gsl_vector * f, gsl_matrix * g) {
+    f_aux(x,pars,f);
+    jf_aux(x,pars,g);
     return 0;
 }
 
@@ -723,9 +725,9 @@
     DEBUGMSG("root_fjf");
     gsl_multiroot_function_fdf my_func;
     // extract function from pars
-    my_func.f = f_aux_root;
-    my_func.df = jf_aux_root;
-    my_func.fdf = fjf_aux_root;
+    my_func.f = f_aux;
+    my_func.df = jf_aux;
+    my_func.fdf = fjf_aux;
     my_func.n = xin;
     Tfjf stfjf;
     stfjf.f = f;
@@ -781,7 +783,77 @@
     OK
 }
 
+//-------------- non linear least squares fitting -------------------
+
+int nlfit(int method, int f(int, double*, int, double*),
+                      int jac(int, double*, int, int, double*),
+         double epsabs, double epsrel, int maxit, int p,
+         KRVEC(xi), RMAT(sol)) {
+    REQUIRES(solr == maxit && solc == 2+xin,BAD_SIZE);
+    DEBUGMSG("nlfit");
+    const gsl_multifit_fdfsolver_type *T;
+    gsl_multifit_fdfsolver *s;
+    gsl_multifit_function_fdf my_f;
+    // extract function from pars
+    my_f.f = f_aux;
+    my_f.df = jf_aux;
+    my_f.fdf = fjf_aux;
+    my_f.n = p;
+    my_f.p = xin;  // !!!!
+    Tfjf stfjf;
+    stfjf.f = f;
+    stfjf.jf = jac;
+    my_f.params = &stfjf;
+    size_t iter = 0;
+    int status;
+
+    KDVVIEW(xi);
+    //DMVIEW(cov);
+
+    switch(method) {
+        case 0 : { T = gsl_multifit_fdfsolver_lmsder; break; }
+        case 1 : { T = gsl_multifit_fdfsolver_lmder; break; }
+        default: ERROR(BAD_CODE);
+    }
+
+    s = gsl_multifit_fdfsolver_alloc (T, my_f.n, my_f.p);
+    gsl_multifit_fdfsolver_set (s, &my_f, V(xi));
+
+    do {   status = gsl_multifit_fdfsolver_iterate (s);
+
+           solp[iter*solc+0] = iter+1;
+           solp[iter*solc+1] = gsl_blas_dnrm2 (s->f);
+
+           int k;
+           for(k=0;k<xin;k++) {
+               solp[iter*solc+k+2] = gsl_vector_get(s->x,k);
+           }
+
+           iter++;
+           if (status)   /* check if solver is stuck */
+             break;
+
+           status = gsl_multifit_test_delta (s->dx, s->x, epsabs, epsrel);
+        }
+        while (status == GSL_CONTINUE && iter <= maxit);
+
+    int i,j;
+    for (i=iter; i<solr; i++) {
+        solp[i*solc+0] = iter;
+        for(j=1;j<solc;j++) {
+            solp[i*solc+j]=0.;
+        }
+    }
+
+    //gsl_multifit_covar (s->J, 0.0, M(cov));
+
+    gsl_multifit_fdfsolver_free (s);
+    OK
+}
+
+
 //////////////////////////////////////////////////////
+
 
 #define RAN(C,F) case C: { for(k=0;k<rn;k++) { rp[k]= F(gen); }; OK }
 
diff --git a/lib/Numeric/LinearAlgebra.hs b/lib/Numeric/LinearAlgebra.hs
--- a/lib/Numeric/LinearAlgebra.hs
+++ b/lib/Numeric/LinearAlgebra.hs
@@ -8,23 +8,16 @@
 Stability   :  provisional
 Portability :  uses ffi
 
-Basic matrix computations implemented by BLAS, LAPACK and GSL.
-
-This module reexports the most comon functions (including "Numeric.LinearAlgebra.Instances").
+This module reexports all normally required functions for Linear Algebra applications.
 
 -}
 -----------------------------------------------------------------------------
 module Numeric.LinearAlgebra (
     module Data.Packed,
-    module Data.Packed.Random,
-    module Numeric.LinearAlgebra.Linear,
     module Numeric.LinearAlgebra.Algorithms,
     module Numeric.LinearAlgebra.Interface
 ) where
 
 import Data.Packed
-import Data.Packed.Random
-import Numeric.LinearAlgebra.Linear
 import Numeric.LinearAlgebra.Algorithms
-import Numeric.LinearAlgebra.Instances()
 import Numeric.LinearAlgebra.Interface
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -27,6 +27,7 @@
 -- * Linear Systems
     linearSolve,
     luSolve,
+    cholSolve,
     linearSolveLS,
     linearSolveSVD,
     inv, pinv,
@@ -45,7 +46,7 @@
 -- ** QR
     qr, rq,
 -- ** Cholesky
-    chol, cholSH,
+    chol, cholSH, mbCholSH,
 -- ** Hessenberg
     hess,
 -- ** Schur
@@ -65,6 +66,7 @@
 -- * Misc
     ctrans,
     eps, i,
+    Linear(..),
 -- * Util
     haussholder,
     unpackQR, unpackHess,
@@ -74,8 +76,10 @@
 ) where
 
 
-import Data.Packed.Internal hiding (fromComplex, toComplex, conj, (//))
-import Data.Packed
+import Data.Packed.Internal hiding ((//))
+import Data.Packed.Vector
+import Data.Packed.Matrix
+import Data.Complex
 import Numeric.GSL.Vector
 import Numeric.LinearAlgebra.LAPACK as LAPACK
 import Numeric.LinearAlgebra.Linear
@@ -91,6 +95,7 @@
     luPacked'    :: Matrix t -> (Matrix t, [Int])
     luSolve'     :: (Matrix t, [Int]) -> Matrix t -> Matrix t
     linearSolve' :: Matrix t -> Matrix t -> Matrix t
+    cholSolve'   :: Matrix t -> Matrix t -> Matrix t
     linearSolveSVD' :: Matrix t -> Matrix t -> Matrix t
     linearSolveLS'  :: Matrix t -> Matrix t -> Matrix t
     eig'         :: Matrix t -> (Vector (Complex Double), Matrix (Complex Double))
@@ -98,6 +103,7 @@
     eigOnly      :: Matrix t -> Vector (Complex Double)
     eigOnlySH    :: Matrix t -> Vector Double
     cholSH'      :: Matrix t -> Matrix t
+    mbCholSH'    :: Matrix t -> Maybe (Matrix t)
     qr'          :: Matrix t -> (Matrix t, Matrix t)
     hess'        :: Matrix t -> (Matrix t, Matrix t)
     schur'       :: Matrix t -> (Matrix t, Matrix t)
@@ -112,6 +118,7 @@
     luPacked' = luR
     luSolve' (l_u,perm) = lusR l_u perm
     linearSolve' = linearSolveR                 -- (luSolve . luPacked) ??
+    cholSolve' = cholSolveR
     linearSolveLS' = linearSolveLSR
     linearSolveSVD' = linearSolveSVDR Nothing
     ctrans' = trans
@@ -120,18 +127,25 @@
     eigOnly = eigOnlyR
     eigOnlySH = eigOnlyS
     cholSH' = cholS
+    mbCholSH' = mbCholS
     qr' = unpackQR . qrR
     hess' = unpackHess hessR
     schur' = schurR
     multiply' = multiplyR
 
 instance Field (Complex Double) where
+#ifdef NOZGESDD
+    svd' = svdC
+    thinSVD' = thinSVDC
+#else
     svd' = svdCd
     thinSVD' = thinSVDCd
+#endif
     sv' = svC
     luPacked' = luC
     luSolve' (l_u,perm) = lusC l_u perm
     linearSolve' = linearSolveC
+    cholSolve' = cholSolveC
     linearSolveLS' = linearSolveLSC
     linearSolveSVD' = linearSolveSVDC Nothing
     ctrans' = conj . trans
@@ -140,6 +154,7 @@
     eigSH'' = eigH
     eigOnlySH = eigOnlyH
     cholSH' = cholH
+    mbCholSH' = mbCholH
     qr' = unpackQR . qrC
     hess' = unpackHess hessC
     schur' = schurC
@@ -157,17 +172,17 @@
 
 -- | Full singular value decomposition.
 svd :: Field t => Matrix t -> (Matrix t, Vector Double, Matrix t)
-svd = svd'
+svd = {-# SCC "svd" #-} svd'
 
 -- | A version of 'svd' which returns only the @min (rows m) (cols m)@ singular vectors of @m@.
 --
 -- If @(u,s,v) = thinSVD m@ then @m == u \<> diag s \<> trans v@.
 thinSVD :: Field t => Matrix t -> (Matrix t, Vector Double, Matrix t)
-thinSVD = thinSVD'
+thinSVD = {-# SCC "thinSVD" #-} thinSVD'
 
 -- | Singular values only.
 singularValues :: Field t => Matrix t -> Vector Double
-singularValues = sv'
+singularValues = {-# SCC "singularValues" #-} sv'
 
 -- | A version of 'svd' which returns an appropriate diagonal matrix with the singular values.
 --
@@ -217,46 +232,50 @@
 --------------------------------------------------------------
 
 -- | Obtains the LU decomposition of a matrix in a compact data structure suitable for 'luSolve'.
-luPacked    :: Field t => Matrix t -> (Matrix t, [Int])
-luPacked = luPacked'
+luPacked :: Field t => Matrix t -> (Matrix t, [Int])
+luPacked = {-# SCC "luPacked" #-} luPacked'
 
 -- | Solution of a linear system (for several right hand sides) from the precomputed LU factorization obtained by 'luPacked'.
-luSolve     :: Field t => (Matrix t, [Int]) -> Matrix t -> Matrix t
-luSolve = luSolve'
+luSolve :: Field t => (Matrix t, [Int]) -> Matrix t -> Matrix t
+luSolve = {-# SCC "luSolve" #-} luSolve'
 
 -- | Solve a linear system (for square coefficient matrix and several right-hand sides) using the LU decomposition. For underconstrained or overconstrained systems use 'linearSolveLS' or 'linearSolveSVD'.
 -- It is similar to 'luSolve' . 'luPacked', but @linearSolve@ raises an error if called on a singular system.
 linearSolve :: Field t => Matrix t -> Matrix t -> Matrix t
-linearSolve = linearSolve'
+linearSolve = {-# SCC "linearSolve" #-} linearSolve'
 
+-- | Solve a symmetric or Hermitian positive definite linear system using a precomputed Cholesky decomposition obtained by 'chol'.
+cholSolve :: Field t => Matrix t -> Matrix t -> Matrix t
+cholSolve = {-# SCC "cholSolve" #-} cholSolve'
+
 -- | Minimum norm solution of a general linear least squares problem Ax=B using the SVD. Admits rank-deficient systems but it is slower than 'linearSolveLS'. The effective rank of A is determined by treating as zero those singular valures which are less than 'eps' times the largest singular value.
 linearSolveSVD :: Field t => Matrix t -> Matrix t -> Matrix t
-linearSolveSVD = linearSolveSVD'
+linearSolveSVD = {-# SCC "linearSolveSVD" #-} linearSolveSVD'
 
 
 -- | Least squared error solution of an overconstrained linear system, or the minimum norm solution of an underconstrained system. For rank-deficient systems use 'linearSolveSVD'.
 linearSolveLS :: Field t => Matrix t -> Matrix t -> Matrix t
-linearSolveLS = linearSolveLS'
+linearSolveLS = {-# SCC "linearSolveLS" #-} linearSolveLS'
 
 --------------------------------------------------------------
 
 -- | Eigenvalues and eigenvectors of a general square matrix.
 --
 -- If @(s,v) = eig m@ then @m \<> v == v \<> diag s@
-eig         :: Field t => Matrix t -> (Vector (Complex Double), Matrix (Complex Double))
-eig = eig'
+eig :: Field t => Matrix t -> (Vector (Complex Double), Matrix (Complex Double))
+eig = {-# SCC "eig" #-} eig'
 
 -- | Eigenvalues of a general square matrix.
 eigenvalues :: Field t => Matrix t -> Vector (Complex Double)
-eigenvalues = eigOnly
+eigenvalues = {-# SCC "eigenvalues" #-} eigOnly
 
--- | Similar to 'eigSH' without checking that the input matrix is hermitian or symmetric.
-eigSH'      :: Field t => Matrix t -> (Vector Double, Matrix t)
-eigSH' = eigSH''
+-- | Similar to 'eigSH' without checking that the input matrix is hermitian or symmetric. It works with the upper triangular part.
+eigSH' :: Field t => Matrix t -> (Vector Double, Matrix t)
+eigSH' = {-# SCC "eigSH'" #-} eigSH''
 
--- | Similar to 'eigenvaluesSH' without checking that the input matrix is hermitian or symmetric.
+-- | Similar to 'eigenvaluesSH' without checking that the input matrix is hermitian or symmetric. It works with the upper triangular part.
 eigenvaluesSH' :: Field t => Matrix t -> Vector Double
-eigenvaluesSH' = eigOnlySH
+eigenvaluesSH' = {-# SCC "eigenvaluesSH'" #-} eigOnlySH
 
 -- | Eigenvalues and Eigenvectors of a complex hermitian or real symmetric matrix.
 --
@@ -275,14 +294,14 @@
 -- | QR factorization.
 --
 -- If @(q,r) = qr m@ then @m == q \<> r@, where q is unitary and r is upper triangular.
-qr          :: Field t => Matrix t -> (Matrix t, Matrix t)
-qr = qr'
+qr :: Field t => Matrix t -> (Matrix t, Matrix t)
+qr = {-# SCC "qr" #-} qr'
 
 -- | RQ factorization.
 --
 -- If @(r,q) = rq m@ then @m == r \<> q@, where q is unitary and r is upper triangular.
 rq :: Field t => Matrix t -> (Matrix t, Matrix t)
-rq m = (r,q) where
+rq m =  {-# SCC "rq" #-} (r,q) where
     (q',r') = qr $ trans $ rev1 m
     r = rev2 (trans r')
     q = rev2 (trans q')
@@ -313,16 +332,19 @@
 
 -- | Matrix product.
 multiply :: Field t => Matrix t -> Matrix t -> Matrix t
-multiply = multiply'
+multiply = {-# SCC "multiply" #-} multiply'
 
+-- | Similar to 'cholSH', but instead of an error (e.g., caused by a matrix not positive definite) it returns 'Nothing'.
+mbCholSH :: Field t => Matrix t -> Maybe (Matrix t)
+mbCholSH = {-# SCC "mbCholSH" #-} mbCholSH'
 
--- | Similar to 'chol' without checking that the input matrix is hermitian or symmetric.
+-- | Similar to 'chol', without checking that the input matrix is hermitian or symmetric. It works with the upper triangular part.
 cholSH      :: Field t => Matrix t -> Matrix t
-cholSH = cholSH'
+cholSH = {-# SCC "cholSH" #-} cholSH'
 
 -- | Cholesky factorization of a positive definite hermitian or symmetric matrix.
 --
--- If @c = chol m@ then @m == ctrans c \<> c@.
+-- If @c = chol m@ then @c@ is upper triangular and @m == ctrans c \<> c@.
 chol :: Field t => Matrix t ->  Matrix t
 chol m | exactHermitian m = cholSH m
        | otherwise = error "chol requires positive definite complex hermitian or real symmetric matrix"
@@ -332,7 +354,7 @@
 
 -- | Determinant of a square matrix.
 det :: Field t => Matrix t -> t
-det m | square m = s * (product $ toList $ takeDiag $ lup)
+det m | square m = {-# SCC "det" #-} s * (product $ toList $ takeDiag $ lup)
       | otherwise = error "det of nonsquare matrix"
     where (lup,perm) = luPacked m
           s = signlp (rows m) perm
@@ -455,8 +477,6 @@
              -> (Vector Double, Matrix t) -- ^ 'rightSV' of m
              -> [Vector t]        -- ^ list of unitary vectors spanning the nullspace
 nullspaceSVD hint a (s,v) = vs where
-    r = rows a
-    c = cols a
     tol = case hint of
         Left t -> t
         _      -> eps
@@ -527,7 +547,7 @@
 
 
 unpackQR :: (Field t) => (Matrix t, Vector t) -> (Matrix t, Matrix t)
-unpackQR (pq, tau) = (q,r)
+unpackQR (pq, tau) =  {-# SCC "unpackQR" #-} (q,r)
     where cs = toColumns pq
           m = rows pq
           n = cols pq
diff --git a/lib/Numeric/LinearAlgebra/Instances.hs b/lib/Numeric/LinearAlgebra/Instances.hs
--- a/lib/Numeric/LinearAlgebra/Instances.hs
+++ b/lib/Numeric/LinearAlgebra/Instances.hs
@@ -22,13 +22,14 @@
 import Numeric.LinearAlgebra.Linear
 import Numeric.GSL.Vector
 import Data.Packed.Matrix
-import Complex
+import Data.Complex
 import Data.List(transpose,intersperse)
-import Foreign(Storable)
-import Data.Monoid
 import Data.Packed.Internal.Vector
--- import Control.Parallel.Strategies
 
+#ifndef VECTOR
+import Foreign(Storable)
+#endif
+
 ------------------------------------------------------------------
 
 instance (Show a, Element a) => (Show (Matrix a)) where
@@ -43,9 +44,13 @@
         pad n str = replicate (n - length str) ' ' ++ str
         unwords' = concat . intersperse ", "
 
+#ifndef VECTOR
+
 instance (Show a, Storable a) => (Show (Vector a)) where
     show v = (show (dim v))++" |> " ++ show (toList v)
 
+#endif
+
 ------------------------------------------------------------------
 
 instance (Element a, Read a) => Read (Matrix a) where
@@ -55,12 +60,23 @@
               cs = read . init . fst. breakAt ')' . snd . breakAt '<' $ dims
               rs = read . snd . breakAt '(' .init . fst . breakAt '>' $ dims
 
+#ifdef VECTOR
+
 instance (Element a, Read a) => Read (Vector a) where
+    readsPrec _ s = [(fromList . read $ listnums, rest)]
+        where (thing,trest) = breakAt ']' s
+              (dims,listnums) = breakAt ' ' (dropWhile (==' ') thing)
+              rest = drop 31 trest
+#else
+
+instance (Element a, Read a) => Read (Vector a) where
     readsPrec _ s = [((d |>) . read $ listnums, rest)]
         where (thing,rest) = breakAt ']' s
               (dims,listnums) = breakAt '>' thing
               d = read . init . fst . breakAt '|' $ dims
 
+#endif
+
 breakAt c l = (a++[c],tail b) where
     (a,b) = break (==c) l
 
@@ -71,10 +87,13 @@
     | dim y == 1 = f3 x (y@>0)
     | otherwise = f2 x y
 
+#ifndef VECTOR
 
 instance Linear Vector a => Eq (Vector a) where
     (==) = equal
 
+#endif
+
 instance Num (Vector Double) where
     (+) = adaptScalar addConstant add (flip addConstant)
     negate = scale (-1)
@@ -182,12 +201,12 @@
 
 ---------------------------------------------------------------
 
-instance (Storable a, Num (Vector a)) => Monoid (Vector a) where
-    mempty = 0 { idim = 0 }
-    mappend a b = mconcat [a,b]
-    mconcat = j . filter ((>0).dim)
-        where j [] = mempty
-              j l  = join l
+-- instance (Storable a, Num (Vector a)) => Monoid (Vector a) where
+--     mempty = 0 { idim = 0 }
+--     mappend a b = mconcat [a,b]
+--     mconcat = j . filter ((>0).dim)
+--         where j [] = mempty
+--               j l  = join l
 
 ---------------------------------------------------------------
 
diff --git a/lib/Numeric/LinearAlgebra/Interface.hs b/lib/Numeric/LinearAlgebra/Interface.hs
--- a/lib/Numeric/LinearAlgebra/Interface.hs
+++ b/lib/Numeric/LinearAlgebra/Interface.hs
@@ -9,8 +9,11 @@
 Stability   :  provisional
 Portability :  portable
 
-(Very provisional) operators for frequent operations.
+Some useful operators, and Show, Read, Eq, Num, Fractional, and Floating instances for Vector and Matrix.
 
+In the context of the standard numeric operators, one-component vectors and matrices automatically expand to match the dimensions of the other operand.
+
+
 -}
 -----------------------------------------------------------------------------
 
@@ -21,14 +24,14 @@
     (<|>),(<->),
 ) where
 
-import Numeric.LinearAlgebra.Linear
+import Numeric.LinearAlgebra.Instances()
 import Data.Packed.Vector
 import Data.Packed.Matrix
 import Numeric.LinearAlgebra.Algorithms
 
 class Mul a b c | a b -> c where
  infixl 7 <>
- -- | matrix product
+ -- | Matrix-matrix, matrix-vector, and vector-matrix products.
  (<>) :: Field t => a t -> b t -> c t
 
 instance Mul Matrix Matrix Matrix where
@@ -42,7 +45,7 @@
 
 ---------------------------------------------------
 
--- | @u \<.\> v = dot u v@
+-- | Dot product: @u \<.\> v = dot u v@
 (<.>) :: (Field t) => Vector t -> Vector t -> t
 infixl 7 <.>
 (<.>) = dot
@@ -51,8 +54,8 @@
 
 {-# DEPRECATED (.*) "use scale a x or scalar a * x" #-}
 
--- | @x .* a = scale x a@
-(.*) :: (Linear c a) => a -> c a -> c a
+-- -- | @x .* a = scale x a@
+-- (.*) :: (Linear c a) => a -> c a -> c a
 infixl 7 .*
 a .* x = scale a x
 
@@ -60,8 +63,8 @@
 
 {-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-}
 
--- | @a *\/ x = scale (recip x) a@
-(*/) :: (Linear c a) => c a -> a -> c a
+-- -- | @a *\/ x = scale (recip x) a@
+-- (*/) :: (Linear c a) => c a -> a -> c a
 infixl 7 */
 v */ x = scale (recip x) v
 
@@ -94,7 +97,7 @@
 infixl 4 <|>
 infixl 3 <->
 
-{- | Horizontal concatenation of matrices and vectors:
+{-- - | Horizontal concatenation of matrices and vectors:
 
 @> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0]
 (6><4)
@@ -105,10 +108,10 @@
  , 0.0, 3.0, 0.0, 5.0
  , 0.0, 0.0, 3.0, 6.0 ]@
 -}
-(<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
+-- (<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
 a <|> b = joinH a b
 
--- | Vertical concatenation of matrices and vectors.
-(<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
+-- -- | Vertical concatenation of matrices and vectors.
+-- (<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
 a <-> b = joinV a b
 
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs
--- a/lib/Numeric/LinearAlgebra/LAPACK.hs
+++ b/lib/Numeric/LinearAlgebra/LAPACK.hs
@@ -18,6 +18,7 @@
     -- * Linear systems
     linearSolveR, linearSolveC,
     lusR, lusC,
+    cholSolveR, cholSolveC,
     linearSolveLSR, linearSolveLSC,
     linearSolveSVDR, linearSolveSVDC,
     -- * SVD
@@ -31,7 +32,7 @@
     -- * LU
     luR, luC,
     -- * Cholesky
-    cholS, cholH,
+    cholS, cholH, mbCholS, mbCholH,
     -- * QR
     qrR, qrC,
     -- * Hessenberg
@@ -40,8 +41,9 @@
     schurR, schurC
 ) where
 
-import Data.Packed.Internal hiding (toComplex)
-import Data.Packed
+import Data.Packed.Internal
+import Data.Packed.Matrix
+import Data.Complex
 import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale))
 import Foreign
 import Foreign.C.Types (CInt)
@@ -236,7 +238,6 @@
           s' = fixeig1 s
           v' = toRows $ trans v
           v'' = fromColumns $ fixeig (toList s') v'
-          r = rows m
 
 eigRaux :: Matrix Double -> (Vector (Complex Double), Matrix Double)
 eigRaux m = unsafePerformIO $ do
@@ -312,8 +313,10 @@
 vrev = flatten . flipud . reshape 1
 
 -----------------------------------------------------------------------------
-foreign import ccall "LAPACK/lapack-aux.h linearSolveR_l" dgesv :: TMMM
-foreign import ccall "LAPACK/lapack-aux.h linearSolveC_l" zgesv :: TCMCMCM
+foreign import ccall "linearSolveR_l" dgesv :: TMMM
+foreign import ccall "linearSolveC_l" zgesv :: TCMCMCM
+foreign import ccall "cholSolveR_l" dpotrs :: TMMM
+foreign import ccall "cholSolveC_l" zpotrs :: TCMCMCM
 
 linearSolveSQAux f st a b
     | n1==n2 && n1==r = unsafePerformIO $ do
@@ -334,6 +337,15 @@
 linearSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double)
 linearSolveC a b = linearSolveSQAux zgesv "linearSolveC" (fmat a) (fmat b)
 
+
+-- | Solves a symmetric positive definite system of linear equations using a precomputed Cholesky factorization obtained by 'cholS'.
+cholSolveR :: Matrix Double -> Matrix Double -> Matrix Double
+cholSolveR a b = linearSolveSQAux dpotrs "cholSolveR" (fmat a) (fmat b)
+
+-- | Solves a Hermitian positive definite system of linear equations using a precomputed Cholesky factorization obtained by 'cholH'.
+cholSolveC :: Matrix (Complex Double) -> Matrix (Complex Double) -> Matrix (Complex Double)
+cholSolveC a b = linearSolveSQAux zpotrs "cholSolveC" (fmat a) (fmat b)
+
 -----------------------------------------------------------------------------------
 foreign import ccall "LAPACK/lapack-aux.h linearSolveLSR_l" dgels :: TMMM
 foreign import ccall "LAPACK/lapack-aux.h linearSolveLSC_l" zgels :: TCMCMCM
@@ -380,19 +392,27 @@
 foreign import ccall "LAPACK/lapack-aux.h chol_l_H" zpotrf :: TCMCM
 foreign import ccall "LAPACK/lapack-aux.h chol_l_S" dpotrf :: TMM
 
+cholAux f st a = do
+    r <- createMatrix ColumnMajor n n
+    app2 f mat a mat r st
+    return r
+  where n = rows a
+
 -- | Cholesky factorization of a complex Hermitian positive definite matrix, using LAPACK's /zpotrf/.
 cholH :: Matrix (Complex Double) -> Matrix (Complex Double)
-cholH = cholAux zpotrf "cholH" . fmat
+cholH = unsafePerformIO . cholAux zpotrf "cholH" . fmat
 
 -- | Cholesky factorization of a real symmetric positive definite matrix, using LAPACK's /dpotrf/.
 cholS :: Matrix Double -> Matrix Double
-cholS = cholAux dpotrf "cholS" . fmat
+cholS =  unsafePerformIO . cholAux dpotrf "cholS" . fmat
 
-cholAux f st a = unsafePerformIO $ do
-    r <- createMatrix ColumnMajor n n
-    app2 f mat a mat r st
-    return r
-  where n = rows a
+-- | Cholesky factorization of a complex Hermitian positive definite matrix, using LAPACK's /zpotrf/ ('Maybe' version).
+mbCholH :: Matrix (Complex Double) -> Maybe (Matrix (Complex Double))
+mbCholH = unsafePerformIO . mbCatch . cholAux zpotrf "cholH" . fmat
+
+-- | Cholesky factorization of a real symmetric positive definite matrix, using LAPACK's /dpotrf/  ('Maybe' version).
+mbCholS :: Matrix Double -> Maybe (Matrix Double)
+mbCholS =  unsafePerformIO . mbCatch . cholAux dpotrf "cholS" . fmat
 
 -----------------------------------------------------------------------------------
 foreign import ccall "LAPACK/lapack-aux.h qr_l_R" dgeqr2 :: TMVM
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
--- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
+++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
@@ -492,6 +492,42 @@
     OK
 }
 
+//////// symmetric positive definite real linear system using Cholesky ////////////
+
+int cholSolveR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
+    integer n = ar;
+    integer nhrs = bc;
+    REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE);
+    DEBUGMSG("cholSolveR_l");
+    memcpy(xp,bp,n*nhrs*sizeof(double));
+    integer res;
+    dpotrs_ ("U",
+             &n,&nhrs,
+             (double*)ap, &n,
+             xp, &n,
+             &res);
+    CHECK(res,res);
+    OK
+}
+
+//////// Hermitian positive definite real linear system using Cholesky ////////////
+
+int cholSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) {
+    integer n = ar;
+    integer nhrs = bc;
+    REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE);
+    DEBUGMSG("cholSolveC_l");
+    memcpy(xp,bp,2*n*nhrs*sizeof(double));
+    integer res;
+    zpotrs_  ("U",
+             &n,&nhrs,
+             (doublecomplex*)ap, &n,
+             (doublecomplex*)xp, &n,
+             &res);
+    CHECK(res,res);
+    OK
+}
+
 //////////////////// least squares real linear system ////////////
 
 int linearSolveLSR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs
--- a/lib/Numeric/LinearAlgebra/Linear.hs
+++ b/lib/Numeric/LinearAlgebra/Linear.hs
@@ -18,10 +18,12 @@
     Linear(..)
 ) where
 
-import Data.Packed
+import Data.Packed.Vector
+import Data.Packed.Matrix
+import Data.Complex
 import Numeric.GSL.Vector
 
--- | A generic interface for vectors and matrices to a few element-by-element functions in Numeric.GSL.Vector.
+-- | Basic element-by-element functions.
 class (Container c e) => Linear c e where
     -- | create a structure with a single element
     scalar      :: e -> c e
diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs
--- a/lib/Numeric/LinearAlgebra/Tests.hs
+++ b/lib/Numeric/LinearAlgebra/Tests.hs
@@ -28,7 +28,7 @@
 import Test.HUnit hiding ((~:),test,Testable)
 import System.Info
 import Data.List(foldl1')
-import Numeric.GSL hiding (sin,cos,exp,choose)
+import Numeric.GSL
 import Prelude hiding ((^))
 import qualified Prelude
 import System.CPUTime
@@ -78,14 +78,19 @@
 
 ---------------------------------------------------------------------
 
-besselTest = utest "bessel_J0_e" ( abs (r-expected) < e )
-    where (r,e) = bessel_J0_e 5.0
-          expected = -0.17759677131433830434739701
+derivTest = abs (d (\x-> x * d (\y-> x+y) 1) 1 - 1) < 1E-10
+    where d f x = fst $ derivCentral 0.01 f x
 
-exponentialTest = utest "exp_e10_e" ( abs (v*10^e - expected) < 4E-2 )
-    where (v,e,_err) = exp_e10_e 30.0
-          expected = exp 30.0
+---------------------------------------------------------------------
 
+-- besselTest = utest "bessel_J0_e" ( abs (r-expected) < e )
+--     where (r,e) = bessel_J0_e 5.0
+--           expected = -0.17759677131433830434739701
+
+-- exponentialTest = utest "exp_e10_e" ( abs (v*10^e - expected) < 4E-2 )
+--     where (v,e,_err) = exp_e10_e 30.0
+--           expected = exp 30.0
+
 ---------------------------------------------------------------------
 
 nd1 = (3><3) [ 1/2, 1/4, 1/4
@@ -143,6 +148,34 @@
 
 ---------------------------------------------------------------------
 
+fittingTest = utest "levmar" (ok1 && ok2)
+    where
+    xs = map return [0 .. 39]
+    sigma = 0.1
+    ys = map return $ toList $ fromList (map (head . expModel [5,0.1,1]) xs)
+                    + scalar sigma * (randomVector 0 Gaussian 40)
+    dats = zip xs (zip ys (repeat sigma))
+    dat = zip xs ys
+
+    expModel [a,lambda,b] [t] = [a * exp (-lambda * t) + b]
+    expModelDer [a,lambda,_b] [t] = [[exp (-lambda * t), -t * a * exp(-lambda*t) , 1]]
+
+    sols = fst $ fitModelScaled 1E-4 1E-4 20 (expModel, expModelDer) dats [1,0,0]
+    sol = fst $ fitModel 1E-4 1E-4 20 (expModel, expModelDer) dat [1,0,0]
+
+    ok1 = and (zipWith f sols [5,0.1,1]) where f (x,d) r = abs (x-r)<2*d
+    ok2 = pnorm PNorm2 (fromList (map fst sols) - fromList sol) < 1E-5
+
+-----------------------------------------------------
+
+mbCholTest = utest "mbCholTest" (ok1 && ok2) where
+    m1 = (2><2) [2,5,5,8 :: Double]
+    m2 = (2><2) [3,5,5,9 :: Complex Double]
+    ok1 = mbCholSH m1 == Nothing
+    ok2 = mbCholSH m2 == Just (chol m2)
+
+---------------------------------------------------------------------
+
 randomTestGaussian = c :~1~: snd (meanCov dat) where
     a = (3><3) [1,2,3,
                 2,4,0,
@@ -180,6 +213,9 @@
     test (multProp1  . cConsist)
     test (multProp2  . rConsist)
     test (multProp2  . cConsist)
+    putStrLn "------ sub-trans"
+    test (subProp . rM)
+    test (subProp . cM)
     putStrLn "------ lu"
     test (luProp    . rM)
     test (luProp    . cM)
@@ -189,6 +225,9 @@
     putStrLn "------ luSolve"
     test (linearSolveProp (luSolve.luPacked) . rSqWC)
     test (linearSolveProp (luSolve.luPacked) . cSqWC)
+    putStrLn "------ cholSolve"
+    test (linearSolveProp (cholSolve.chol) . rPosDef)
+    test (linearSolveProp (cholSolve.chol) . cPosDef)
     putStrLn "------ luSolveLS"
     test (linearSolveProp linearSolveLS . rSqWC)
     test (linearSolveProp linearSolveLS . cSqWC)
@@ -206,7 +245,9 @@
     test (svdProp1a svdR)
     test (svdProp1a svdC)
     test (svdProp1a svdRd)
-    test (svdProp1a svdCd)
+    test (svdProp1b svdR)
+    test (svdProp1b svdC)
+    test (svdProp1b svdRd)
     test (svdProp2 thinSVDR)
     test (svdProp2 thinSVDC)
     test (svdProp2 thinSVDRd)
@@ -221,6 +262,13 @@
     test (svdProp6b)
     test (svdProp7  . rM)
     test (svdProp7  . cM)
+    putStrLn "------ svdCd"
+#ifdef NOZGESDD
+    putStrLn "Omitted"
+#else
+    test (svdProp1a svdCd)
+    test (svdProp1b svdCd)
+#endif
     putStrLn "------ eig"
     test (eigSHProp . rHer)
     test (eigSHProp . cHer)
@@ -273,9 +321,10 @@
         , utest "arith2" $ ((scalar (1+i) * ones (100,100) * 5 + 2)/0.5 - 7)**2 |~| ( scalar (140*i-51) :: CM)
         , utest "arith3" $ exp (scalar i * ones(10,10)*pi) + 1 |~| 0
         , utest "<\\>"   $ (3><2) [2,0,0,3,1,1::Double] <\> 3|>[4,9,5] |~| 2|>[2,3]
-        , utest "gamma" (gamma 5 == 24.0)
-        , besselTest
-        , exponentialTest
+--        , utest "gamma" (gamma 5 == 24.0)
+--        , besselTest
+--        , exponentialTest
+        , utest "deriv" derivTest
         , utest "integrate" (abs (volSphere 2.5 - 4/3*pi*2.5^3) < 1E-8)
         , utest "polySolve" (polySolveProp [1,2,3,4])
         , minimizationTest
@@ -289,6 +338,8 @@
                        && rank ((2><3)[1,0,0,1,7*eps,0]) == 2
         , utest "block" $ fromBlocks [[ident 3,0],[0,ident 4]] == (ident 7 :: CM)
         , odeTest
+        , fittingTest
+        , mbCholTest
         ]
     return ()
 
@@ -305,6 +356,8 @@
 -- | Performance measurements.
 runBenchmarks :: IO ()
 runBenchmarks = do
+    solveBench
+    subBench
     multBench
     svdBench
     eigBench
@@ -317,7 +370,7 @@
     t0 <- getCPUTime
     act `seq` putStr " "
     t1 <- getCPUTime
-    printf "%5.1f s CPU\n" $ (fromIntegral (t1 - t0) / (10^12 :: Double)) :: IO ()
+    printf "%6.2f s CPU\n" $ (fromIntegral (t1 - t0) / (10^12 :: Double)) :: IO ()
     return ()
 
 --------------------------------
@@ -335,6 +388,16 @@
 
 --------------------------------
 
+subBench = do
+    putStrLn ""
+    let g = foldl1' (.) (replicate (10^5) (\v -> subVector 1 (dim v -1) v))
+    time "0.1M subVector   " (g (constant 1 (1+10^5) :: Vector Double) @> 0)
+    let f = foldl1' (.) (replicate (10^5) (fromRows.toRows))
+    time "subVector-join  3" (f (ident  3 :: Matrix Double) @@>(0,0))
+    time "subVector-join 10" (f (ident 10 :: Matrix Double) @@>(0,0))
+
+--------------------------------
+
 multBench = do
     let a = ident 1000 :: Matrix Double
     let b = ident 2000 :: Matrix Double
@@ -376,3 +439,19 @@
     time "singular values 1000x1000" (singularValues b)
     time "full svd        1000x1000" (fv $ svd b)
 
+--------------------------------
+
+solveBenchN n = do
+    let x = uniformSample 777 (2*n) (replicate n (-1,1))
+        a = trans x <> x
+        b = asColumn $ randomVector 666 Uniform n
+    a `seq` b `seq` putStrLn ""
+    time ("svd solve " ++ show n) (linearSolveSVD a b)
+    time (" ls solve " ++ show n) (linearSolveLS a b)
+    time ("    solve " ++ show n) (linearSolve a b)
+    time ("cholSolve " ++ show n) (cholSolve (chol a) b)
+
+solveBench = do
+    solveBenchN 500
+    solveBenchN 1000
+    -- solveBenchN 1500
diff --git a/lib/Numeric/LinearAlgebra/Tests/Properties.hs b/lib/Numeric/LinearAlgebra/Tests/Properties.hs
--- a/lib/Numeric/LinearAlgebra/Tests/Properties.hs
+++ b/lib/Numeric/LinearAlgebra/Tests/Properties.hs
@@ -29,7 +29,7 @@
     pinvProp,
     detProp,
     nullspaceProp,
-    svdProp1, svdProp1a, svdProp2, svdProp3, svdProp4,
+    svdProp1, svdProp1a, svdProp1b, svdProp2, svdProp3, svdProp4,
     svdProp5a, svdProp5b, svdProp6a, svdProp6b, svdProp7,
     eigProp, eigSHProp, eigProp2, eigSHProp2,
     qrProp, rqProp,
@@ -38,6 +38,7 @@
     cholProp,
     expmDiagProp,
     multProp1, multProp2,
+    subProp,
     linearSolveProp, linearSolveProp2
 ) where
 
@@ -119,7 +120,8 @@
           (q,r) = qr m
           s x = fromList [x]
 
-nullspaceProp m = null nl `trivial` (null nl || m <> n |~| zeros (r,c))
+nullspaceProp m = null nl `trivial` (null nl || m <> n |~| zeros (r,c)
+                                     && orthonormal (fromColumns nl))
     where nl = nullspacePrec 1 m
           n = fromColumns nl
           r = rows m
@@ -135,6 +137,9 @@
     (u,s,v) = svdfun m
     d = diagRect s (rows m) (cols m)
 
+svdProp1b svdfun m = unitary u && unitary v where
+    (u,_,v) = svdfun m
+
 -- thinSVD
 svdProp2 thinSVDfun m = m |~| u <> diag (real s) <> trans v && orthonormal u && orthonormal v && dim s == min (rows m) (cols m)
     where (u,s,v) = thinSVDfun m
@@ -180,7 +185,7 @@
 svdProp7 m = s |~| s' && u |~| u' && v |~| v' && s |~| s'''
     where (u,s,v) = svd m
           (s',v') = rightSV m
-          (u',s'') = leftSV m
+          (u',_s'') = leftSV m
           s''' = singularValues m
 
 ------------------------------------------------------------------
@@ -242,3 +247,6 @@
     where q = min (rows a) (cols a)
           b = a <> x
           wc = rank a == q
+
+subProp m = m == (trans . fromColumns . toRows) m
+
