numeric-prelude 0.2.1 → 0.2.2
raw patch · 5 files changed
+52/−12 lines, 5 files
Files
- numeric-prelude.cabal +2/−2
- src-ghc-6.12/MathObj/Gaussian/Variance.hs +10/−2
- src/MathObj/Gaussian/Variance.hs +10/−2
- test-ghc-6.12/Test/MathObj/Gaussian/Variance.hs +15/−3
- test/Test/MathObj/Gaussian/Variance.hs +15/−3
numeric-prelude.cabal view
@@ -1,5 +1,5 @@ Name: numeric-prelude-Version: 0.2.1+Version: 0.2.2 License: GPL License-File: LICENSE Author: Dylan Thurston <dpt@math.harvard.edu>, Henning Thielemann <numericprelude@henning-thielemann.de>, Mikael Johansson@@ -378,7 +378,7 @@ default: False Source-Repository this- Tag: 0.2.1+ Tag: 0.2.2 Type: darcs Location: http://code.haskell.org/numeric-prelude/
src-ghc-6.12/MathObj/Gaussian/Variance.hs view
@@ -60,9 +60,17 @@ Poly.fromCoeffs [zero, zero, c f] -norm1Root :: (Field.C a) => T a -> Root.T a-norm1Root f =+integrateRoot :: (Field.C a) => T a -> Root.T a+integrateRoot f = Root.sqrt $ Root.fromNumber $ amp f / c f++scalarProductRoot :: (Field.C a) => T a -> T a -> Root.T a+scalarProductRoot f g =+ integrateRoot (multiply f g)+++norm1Root :: (Field.C a) => T a -> Root.T a+norm1Root = integrateRoot norm2Root :: (Field.C a) => T a -> Root.T a norm2Root f =
src/MathObj/Gaussian/Variance.hs view
@@ -60,9 +60,17 @@ Poly.fromCoeffs [zero, zero, c f] -norm1Root :: (Field.C a) => T a -> Root.T a-norm1Root f =+integrateRoot :: (Field.C a) => T a -> Root.T a+integrateRoot f = Root.sqrt $ Root.fromNumber $ amp f / c f++scalarProductRoot :: (Field.C a) => T a -> T a -> Root.T a+scalarProductRoot f g =+ integrateRoot (multiply f g)+++norm1Root :: (Field.C a) => T a -> Root.T a+norm1Root = integrateRoot norm2Root :: (Field.C a) => T a -> Root.T a norm2Root f =
test-ghc-6.12/Test/MathObj/Gaussian/Variance.hs view
@@ -38,12 +38,20 @@ data HoelderConjugates = HoelderConjugates Rational Rational deriving Show +{- instance Arbitrary HoelderConjugates where arbitrary = liftM2 (\(PositiveInteger p) (PositiveInteger q) -> let s = 1%p + 1%q in HoelderConjugates (fromInteger p * s) (fromInteger q * s)) arbitrary arbitrary+-}+instance Arbitrary HoelderConjugates where+ arbitrary = liftM2+ (\(PositiveInteger p) (PositiveInteger q) ->+ let s = p + q+ in HoelderConjugates (s % p) (s % q))+ arbitrary arbitrary {- | For @(YoungConjugates p q r)@ it holds@@ -135,6 +143,10 @@ ("fourier dilate", simple $ \x a -> a>0 ==> G.fourier (G.dilate a x) == G.amplify a (G.shrink a (G.fourier x))) :+ ("fourier, unitary",+ simple $ \x y ->+ G.scalarProductRoot x y+ == G.scalarProductRoot (G.fourier x) (G.fourier y)) : ("norm1 vs. normP 1", simple $ \x -> G.norm1Root x == G.normPRoot 1 x) : ("norm2 vs. normP 2",@@ -167,18 +179,18 @@ -} ("Cauchy-Schwarz inequality", simple $ \x y ->- G.norm1Root (G.multiply x y)+ G.scalarProductRoot x y <= G.norm2Root x `Root.mul` G.norm2Root y) : ("Hoelder conjugates", quickCheck $ \(HoelderConjugates p q) -> p>=1 && q>=1 && 1/p + 1/q == 1) : ("Hoelder inequality with infinity norm", simple $ \x y ->- G.norm1Root (G.multiply x y)+ G.scalarProductRoot x y <= G.norm1Root x `Root.mul` G.normInfRoot y) : ("Hoelder inequality", simple $ \x y (HoelderConjugates p q) ->- G.norm1Root (G.multiply x y)+ G.scalarProductRoot x y <= G.normPRoot p x `Root.mul` G.normPRoot q y) : ("Young inequality with two infinity norms", simple $ \x y ->
test/Test/MathObj/Gaussian/Variance.hs view
@@ -38,12 +38,20 @@ data HoelderConjugates = HoelderConjugates Rational Rational deriving Show +{- instance Arbitrary HoelderConjugates where arbitrary = liftM2 (\(PositiveInteger p) (PositiveInteger q) -> let s = 1%p + 1%q in HoelderConjugates (fromInteger p * s) (fromInteger q * s)) arbitrary arbitrary+-}+instance Arbitrary HoelderConjugates where+ arbitrary = liftM2+ (\(PositiveInteger p) (PositiveInteger q) ->+ let s = p + q+ in HoelderConjugates (s % p) (s % q))+ arbitrary arbitrary {- | For @(YoungConjugates p q r)@ it holds@@ -135,6 +143,10 @@ ("fourier dilate", simple $ \x a -> a>0 ==> G.fourier (G.dilate a x) == G.amplify a (G.shrink a (G.fourier x))) :+ ("fourier, unitary",+ simple $ \x y ->+ G.scalarProductRoot x y+ == G.scalarProductRoot (G.fourier x) (G.fourier y)) : ("norm1 vs. normP 1", simple $ \x -> G.norm1Root x == G.normPRoot 1 x) : ("norm2 vs. normP 2",@@ -167,18 +179,18 @@ -} ("Cauchy-Schwarz inequality", simple $ \x y ->- G.norm1Root (G.multiply x y)+ G.scalarProductRoot x y <= G.norm2Root x `Root.mul` G.norm2Root y) : ("Hoelder conjugates", quickCheck $ \(HoelderConjugates p q) -> p>=1 && q>=1 && 1/p + 1/q == 1) : ("Hoelder inequality with infinity norm", simple $ \x y ->- G.norm1Root (G.multiply x y)+ G.scalarProductRoot x y <= G.norm1Root x `Root.mul` G.normInfRoot y) : ("Hoelder inequality", simple $ \x y (HoelderConjugates p q) ->- G.norm1Root (G.multiply x y)+ G.scalarProductRoot x y <= G.normPRoot p x `Root.mul` G.normPRoot q y) : ("Young inequality with two infinity norms", simple $ \x y ->