From ff8ba85a52acdd1e30f45ba73ae0c40986c8a9d4 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 12 May 2010 06:15:35 +0000 Subject: more simplification --- lib/Numeric/LinearAlgebra/Algorithms.hs | 6 ++++-- lib/Numeric/LinearAlgebra/Interface.hs | 4 +--- lib/Numeric/LinearAlgebra/LAPACK.hs | 5 +++-- lib/Numeric/LinearAlgebra/Linear.hs | 4 +++- lib/Numeric/LinearAlgebra/Tests.hs | 6 ++++++ 5 files changed, 17 insertions(+), 8 deletions(-) (limited to 'lib/Numeric/LinearAlgebra') diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 7de9587..55398e0 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs @@ -76,8 +76,10 @@ module Numeric.LinearAlgebra.Algorithms ( ) 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 diff --git a/lib/Numeric/LinearAlgebra/Interface.hs b/lib/Numeric/LinearAlgebra/Interface.hs index 750670b..30547d9 100644 --- a/lib/Numeric/LinearAlgebra/Interface.hs +++ b/lib/Numeric/LinearAlgebra/Interface.hs @@ -9,9 +9,7 @@ Maintainer : Alberto Ruiz (aruiz at um dot es) Stability : provisional Portability : portable -Operators for frequent operations. - -This module exports Show, Read, Eq, Num, Fractional, and Floating instances for Vector and Matrix. +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. diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs index f5af8be..7f057ba 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK.hs +++ b/lib/Numeric/LinearAlgebra/LAPACK.hs @@ -41,8 +41,9 @@ module Numeric.LinearAlgebra.LAPACK ( 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) diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs index 2568410..c802712 100644 --- a/lib/Numeric/LinearAlgebra/Linear.hs +++ b/lib/Numeric/LinearAlgebra/Linear.hs @@ -18,7 +18,9 @@ module Numeric.LinearAlgebra.Linear ( Linear(..) ) where -import Data.Packed +import Data.Packed.Vector +import Data.Packed.Matrix +import Data.Complex import Numeric.GSL.Vector -- | Basic element-by-element functions. diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs index ac26466..65b0e4c 100644 --- a/lib/Numeric/LinearAlgebra/Tests.hs +++ b/lib/Numeric/LinearAlgebra/Tests.hs @@ -78,6 +78,11 @@ volSphere r = 8 * quad2 (\x y -> sqrt (r*r-x*x-y*y)) --------------------------------------------------------------------- +derivTest = abs (d (\x-> x * d (\y-> x+y) 1) 1 - 1) < 1E-10 + where d f x = fst $ derivCentral 0.01 f x + +--------------------------------------------------------------------- + -- besselTest = utest "bessel_J0_e" ( abs (r-expected) < e ) -- where (r,e) = bessel_J0_e 5.0 -- expected = -0.17759677131433830434739701 @@ -319,6 +324,7 @@ runTests n = do -- , 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 -- cgit v1.2.3