numeric-prelude 0.0.4 → 0.0.5
raw patch · 2 files changed
+18/−10 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Number.Complex: exp :: (C a) => T a -> T a
+ Number.Complex: scale :: (C a) => a -> T a -> T a
Files
- numeric-prelude.cabal +7/−7
- src/Number/Complex.hs +11/−3
numeric-prelude.cabal view
@@ -1,10 +1,10 @@ Name: numeric-prelude-Version: 0.0.4+Version: 0.0.5 License: GPL License-File: LICENSE Author: Dylan Thurston <dpt@math.harvard.edu>, Henning Thielemann <numericprelude@henning-thielemann.de>, Mikael Johansson Maintainer: Henning Thielemann <numericprelude@henning-thielemann.de>-Homepage: http://www.haskell.org/haskellwiki/Mathematical_prelude_discussion+Homepage: http://www.haskell.org/haskellwiki/Numeric_Prelude Package-URL: http://darcs.haskell.org/numericprelude/ Category: Math Stability: Experimental@@ -97,10 +97,10 @@ * I stuck with the Haskell 98 names. In some cases I find them lacking. Neglecting backwards compatibility, we have renamed classes as follows:- Num --> Ring- Fractional --> Field- Floating --> Algebraic, Transcendental- RealFloat --> RealTranscental+ Num --> Ring,+ Fractional --> Field,+ Floating --> Algebraic + Transcendental,+ RealFloat --> RealTranscendental, . * It's slightly unfortunate that 'abs' can no longer be used for complex numbers, since it is standard mathematically.@@ -111,7 +111,7 @@ . Additional standard libraries might include Enum, IEEEFloat (including the bulk of the functions in Haskell 98's RealFloat class),- VectorSpace, Ratio.T, and Lattice.+ VectorSpace, Ratio, and Lattice. Tested-With: GHC==6.4.1, GHC==6.8.2 Cabal-Version: >=1.2 Build-Type: Simple
src/Number/Complex.hs view
@@ -1,6 +1,6 @@ {-# OPTIONS_GHC -fno-implicit-prelude -fglasgow-exts #-} {-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE_HOW_CAN_WE_ENABLE Rules ? #-}+{- Rules should be processed -} {- | Module : Number.Complex Copyright : (c) The University of Glasgow 2001@@ -22,6 +22,9 @@ (+:), (-:),+ scale,+ exp,+ -- * Polar form fromPolar, cis,@@ -71,7 +74,7 @@ import qualified Prelude as P import PreludeBase-import NumericPrelude hiding (signum)+import NumericPrelude hiding (signum, exp, ) import NumericPrelude.Text (showsInfixPrec, readsInfixPrec) @@ -138,6 +141,11 @@ scale :: (Ring.C a) => a -> T a -> T a scale r (Cons x y) = Cons (r * x) (r * y) +-- | Exponential of a complex number with minimal type class constraints.+{-# INLINE exp #-}+exp :: (Trans.C a) => T a -> T a+exp (Cons x y) = scale (Trans.exp x) (cis y)+ -- | Turn the point one quarter to the right. {-# INLINE orthoRight #-} {-# INLINE orthoLeft #-}@@ -460,7 +468,7 @@ {-# INLINE pi #-} pi = fromReal pi {-# INLINE exp #-}- exp (Cons x y) = scale (exp x) (cis y)+ exp = exp {-# INLINE log #-} log z = let (m,p) = toPolar z in Cons (log m) p