summaryrefslogtreecommitdiff
path: root/dev-haskell/math-functions
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-10-23 08:35:49 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-10-23 08:35:49 +0100
commit386855c4d1ef509c1fd32abd721589c81669613b (patch)
tree35dc984118f0a7dc2df88313d83bb5779fd12514 /dev-haskell/math-functions
parent0118ac4510d7b85ca62da20e4abd1286dd8bd752 (diff)
gentoo auto-resync : 23:10:2023 - 08:35:49
Diffstat (limited to 'dev-haskell/math-functions')
-rw-r--r--dev-haskell/math-functions/Manifest7
-rw-r--r--dev-haskell/math-functions/files/math-functions-0.3.4.2-fix-test-suite.patch118
-rw-r--r--dev-haskell/math-functions/math-functions-0.3.3.0.ebuild2
-rw-r--r--dev-haskell/math-functions/math-functions-0.3.4.2.ebuild43
-rw-r--r--dev-haskell/math-functions/metadata.xml8
5 files changed, 169 insertions, 9 deletions
diff --git a/dev-haskell/math-functions/Manifest b/dev-haskell/math-functions/Manifest
index 0c1d732ea5d9..12d036db2b95 100644
--- a/dev-haskell/math-functions/Manifest
+++ b/dev-haskell/math-functions/Manifest
@@ -1,3 +1,6 @@
+AUX math-functions-0.3.4.2-fix-test-suite.patch 4460 BLAKE2B a296085d8156fd6223141da0c7d800aaec385e10f7b305dac72cd93adfce92bf6f5099b462b40e6ef536f09a68cfa06d972b2dbd5763a62d486d07ebda35c2d3 SHA512 457585c738132e68611f6a7518675f61d24e55cb34e4cc54698cce5d4635ab10d9305c3da44e4c115b5f2e9fee6858026c7b2d017fca02be8b149cd972c4b2b7
DIST math-functions-0.3.3.0.tar.gz 424169 BLAKE2B 8b53c657fb5eba8d3ab54d5ba29f7d316e8c2f4803d0587a1071fd9b6c0cf0d8a17c4dadc903280faf028622207ab84db5fb628c8826af0e615524ef45b625c5 SHA512 f6ac6f9fb604207c11d7888fa375a52b544732dd8e811c3b9bf74237bbc0dc83839eb83c11c5ef0dd88666cff4919d4e06236e14d84da7065b4dc75717ceafad
-EBUILD math-functions-0.3.3.0.ebuild 1055 BLAKE2B 9378714b32634fd80a04279c9cc743dcbd1d72e20f883c6c4a731e903baae492b92a4e0c7e2a353ad18308836f1d3656a1562749cefbb91d660280c4539322a3 SHA512 56670e19140a7a4b7854748f4b9261a59b8101ac548dede10e5c0c8f026ba22fa1b46a6e0b6fd869d30cb488d0b2e94784477115bf476a0ef5ba4bde50361223
-MISC metadata.xml 555 BLAKE2B 9b0a713ad9453b4d2e9ad09455ace9a155621bf0affa279c7c7371f875c34bffab949493a627bb71f70909105e59a97d2da26d50d9fa8bfa2a882c7edd8c32a9 SHA512 1356bbd9da54d8e3cfcce5a91c572d71a70110cef3d805f782a311cd45849f8812f5c55b480378154343f2e835b3517a96bfe8e5cd17a59108aec65f441e236a
+DIST math-functions-0.3.4.2.tar.gz 429223 BLAKE2B 63d305c524c6ab40c415828375a8c2491911693fdf7a1462b9e4d9055a26e1570fb4e80eee8dd617852c96dfc802b6e6a8e2d7bc822d9bf62c00241e5cf43dd7 SHA512 cb29901294463edbba37e97445bb9ed039bdc43815c9bbd9b9bb92b87393e6e891f5840d337c6c06c7e30d26107d32a59c39ac51436be43dba00d0e2411a9053
+EBUILD math-functions-0.3.3.0.ebuild 1055 BLAKE2B 06c1e3837f8d02b9b64de4656f2f2468e508ba8b0605c744f4d7945a60b4111e76ef35f5a9beecf6bfd11e2217297c39a36f60c5c54b2825a31edbad9ed50310 SHA512 1e6a01fc0c9aaffebc70de4c59d7f9f8aed3c466c8536512ebd78a1b68a952b79db198a0b8d7c6b9f5ca44ed7fc7fc83972ba2ec941375c7bc1970aa73a6cef9
+EBUILD math-functions-0.3.4.2.ebuild 1091 BLAKE2B 57305237fd389dd8a1ce7f156c6a7b612255eed54453a6a9acde6d28593c04fd33b51c3e447ce61cf58bb3efdca43c1bedb72242455b6bd273f09ecd032c5a01 SHA512 5f9bf9427d57ed9725010b9b0846409a5b8d0ccd1828137358f5eaf20c705924ee795b3573884a95872d20cdfd1bc8e4c280a457deca9a1ceeb7ccf6957d5783
+MISC metadata.xml 388 BLAKE2B 52ca87babdedc2d9fe82b1f92369dca18a7ef89e27b0d89d7a3680734484cc5211a512edac1de430e6ddd8cf0287a51d7d74af18c9e5adff7c40884d9840b1e3 SHA512 2c688dfe2027c7c3aac824985e85358b3ffd652536e67ba7cb880776a8910fee6777f54abde35c0ee6712c896c28d45801e6796e2f1d748f788204071215765c
diff --git a/dev-haskell/math-functions/files/math-functions-0.3.4.2-fix-test-suite.patch b/dev-haskell/math-functions/files/math-functions-0.3.4.2-fix-test-suite.patch
new file mode 100644
index 000000000000..5dd2d9c622f7
--- /dev/null
+++ b/dev-haskell/math-functions/files/math-functions-0.3.4.2-fix-test-suite.patch
@@ -0,0 +1,118 @@
+From 7e5deed1cb3fafdd6eb035b3713ae2f46b67014a Mon Sep 17 00:00:00 2001
+From: Alexey Khudyakov <alexey.skladnoy@gmail.com>
+Date: Thu, 8 Jun 2023 13:26:11 +0300
+Bug: https://github.com/haskell/math-functions/pull/75
+Signed-off-by: hololeap <hololeap@protonmail.com>
+Subject: [PATCH] Fix test suite
+
+QC as of 2.14.3. became much better at generating test cases and started
+reliably failing Kahan summation
+
+This was fixed by tweaking badvec to be just very bad. Not outrageously
+bad.
+---
+ tests/Tests/Sum.hs | 72 +++++++++++++++++++++++++++-------------------
+ 1 file changed, 43 insertions(+), 29 deletions(-)
+
+diff --git a/tests/Tests/Sum.hs b/tests/Tests/Sum.hs
+index 08eaf1e..1fcb2e9 100644
+--- a/tests/Tests/Sum.hs
++++ b/tests/Tests/Sum.hs
+@@ -4,54 +4,68 @@ module Tests.Sum (tests) where
+
+ import Control.Applicative ((<$>))
+ import Numeric.Sum as Sum
++import Numeric.MathFunctions.Comparison
+ import Prelude hiding (sum)
+ import Test.Tasty (TestTree, testGroup)
+-import Test.Tasty.QuickCheck (testProperty)
++import Test.Tasty.QuickCheck
+ import Test.QuickCheck (Arbitrary(..))
+ import qualified Prelude
+
+-t_sum :: ([Double] -> Double) -> [Double] -> Bool
+-t_sum f xs = f xs == trueSum xs
+-
+-t_sum_error :: ([Double] -> Double) -> [Double] -> Bool
+-t_sum_error f xs = abs (ts - f xs) <= abs (ts - Prelude.sum xs)
+- where ts = trueSum xs
+-
+-t_sum_shifted :: ([Double] -> Double) -> [Double] -> Bool
++-- Test that summation result is same as exact sum. That should pass
++-- if we're effectively working with quad precision
++t_sum :: ([Double] -> Double) -> [Double] -> Property
++t_sum f xs
++ = counterexample ("APPROX = " ++ show approx)
++ $ counterexample ("EXACT = " ++ show exact)
++ $ counterexample ("DELTA = " ++ show (approx - exact))
++ $ counterexample ("ULPS = " ++ show (ulpDistance approx exact))
++ $ approx == exact
++ where
++ approx = f xs
++ exact = trueSum xs
++
++-- Test that summation has smaller error than naive summation or no
++-- worse than given number of ulps. If we're close enough to exact
++-- answer naive may get ahead
++t_sum_error :: ([Double] -> Double) -> [Double] -> Property
++t_sum_error f xs
++ = counterexample ("APPROX = " ++ show approx)
++ $ counterexample ("NAIVE = " ++ show naive)
++ $ counterexample ("EXACT = " ++ show exact)
++ $ counterexample ("A-EXACT = " ++ show (approx - exact))
++ $ counterexample ("N-EXACT = " ++ show (naive - exact))
++ $ counterexample ("ULPS[A] = " ++ show (ulpDistance approx exact))
++ $ counterexample ("ULPS[N] = " ++ show (ulpDistance naive exact))
++ $ abs (exact - approx) <= abs (exact - naive)
++ where
++ naive = Prelude.sum xs
++ approx = f xs
++ exact = trueSum xs
++
++t_sum_shifted :: ([Double] -> Double) -> [Double] -> Property
+ t_sum_shifted f = t_sum_error f . zipWith (+) badvec
+
+ trueSum :: (Fractional b, Real a) => [a] -> b
+ trueSum xs = fromRational . Prelude.sum . map toRational $ xs
+
+ badvec :: [Double]
+-badvec = cycle [1,1e16,-1e16]
++badvec = cycle [1, 1e14, -1e14]
+
+ tests :: TestTree
+-tests = testGroup "Summation" [
+- testGroup "ID" [
+- -- plain summation loses precision quickly
+- -- testProperty "t_sum" $ t_sum (sum id)
+-
+- -- tautological tests:
+- -- testProperty "t_sum_error" $ t_sum_error (sum id)
+- -- testProperty "t_sum_shifted" $ t_sum_shifted (sum id)
+- ]
+- , testGroup "Kahan" [
+- -- tests that cannot pass:
+- -- testProprty "t_sum" $ t_sum (sum kahan)
+- -- testProperty "t_sum_error" $ t_sum_error (sum kahan)
+-
+- -- kahan summation only beats normal summation with large values
++tests = testGroup "Summation"
++ [ testGroup "Kahan" [
++ -- Kahan summation only beats naive summation when truly
++ -- catastrophic cancellation occurs
+ testProperty "t_sum_shifted" $ t_sum_shifted (sum kahan)
+ ]
+ , testGroup "KBN" [
+- testProperty "t_sum" $ t_sum (sum kbn)
+- , testProperty "t_sum_error" $ t_sum_error (sum kbn)
++ testProperty "t_sum" $ t_sum (sum kbn)
++ , testProperty "t_sum_error" $ t_sum_error (sum kbn)
+ , testProperty "t_sum_shifted" $ t_sum_shifted (sum kbn)
+ ]
+ , testGroup "KB2" [
+- testProperty "t_sum" $ t_sum (sum kb2)
+- , testProperty "t_sum_error" $ t_sum_error (sum kb2)
++ testProperty "t_sum" $ t_sum (sum kb2)
++ , testProperty "t_sum_error" $ t_sum_error (sum kb2)
+ , testProperty "t_sum_shifted" $ t_sum_shifted (sum kb2)
+ ]
+ ]
diff --git a/dev-haskell/math-functions/math-functions-0.3.3.0.ebuild b/dev-haskell/math-functions/math-functions-0.3.3.0.ebuild
index 114bf12cee3f..26a5949bcd1c 100644
--- a/dev-haskell/math-functions/math-functions-0.3.3.0.ebuild
+++ b/dev-haskell/math-functions/math-functions-0.3.3.0.ebuild
@@ -1,7 +1,7 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
# ebuild generated by hackport 0.6.1.9999
#hackport: flags: +system-erf,+system-expm1
diff --git a/dev-haskell/math-functions/math-functions-0.3.4.2.ebuild b/dev-haskell/math-functions/math-functions-0.3.4.2.ebuild
new file mode 100644
index 000000000000..cb3dfe1b5008
--- /dev/null
+++ b/dev-haskell/math-functions/math-functions-0.3.4.2.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# ebuild generated by hackport 0.6.7.9999
+#hackport: flags: +system-erf,+system-expm1
+
+CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
+inherit haskell-cabal
+
+DESCRIPTION="Collection of tools for numeric computations"
+HOMEPAGE="https://github.com/bos/math-functions"
+SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
+
+LICENSE="BSD-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.3.4.2-fix-test-suite.patch"
+)
+
+RDEPEND=">=dev-haskell/data-default-class-0.1.2.0:=[profile?]
+ dev-haskell/primitive:=[profile?]
+ >=dev-haskell/vector-0.11:=[profile?]
+ >=dev-lang/ghc-8.4.3:=
+"
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-2.2.0.1
+ test? ( dev-haskell/erf
+ >=dev-haskell/quickcheck-2.7
+ >=dev-haskell/tasty-1.2
+ >=dev-haskell/tasty-hunit-0.10
+ >=dev-haskell/tasty-quickcheck-0.10
+ dev-haskell/vector-th-unbox )
+"
+
+src_configure() {
+ haskell-cabal_src_configure \
+ --flag=system-erf \
+ --flag=system-expm1
+}
diff --git a/dev-haskell/math-functions/metadata.xml b/dev-haskell/math-functions/metadata.xml
index 34d3ae1258d4..6e48d98c7be5 100644
--- a/dev-haskell/math-functions/metadata.xml
+++ b/dev-haskell/math-functions/metadata.xml
@@ -5,12 +5,8 @@
<email>haskell@gentoo.org</email>
<name>Gentoo Haskell</name>
</maintainer>
- <longdescription>
- This library provides implementations of special mathematical
- functions and Chebyshev polynomials. These functions are often
- useful in statistical and numerical computing.
- </longdescription>
<upstream>
- <remote-id type="github">haskell/math-functions</remote-id>
+ <remote-id type="hackage">math-functions</remote-id>
+ <remote-id type="github">bos/math-functions</remote-id>
</upstream>
</pkgmetadata>