From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id YFZwKapdRmVD3QAAG6o9tA:P1 (envelope-from ) for ; Sat, 04 Nov 2023 16:05:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id YFZwKapdRmVD3QAAG6o9tA (envelope-from ) for ; Sat, 04 Nov 2023 16:05:14 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 39EF317341 for ; Sat, 4 Nov 2023 16:05:13 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=DnnxMZhE; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699110314; a=rsa-sha256; cv=none; b=M0LehqGwnM+M790PR7ghe7zaqSxOb4LChI81vs2s0PZ3xlzF/LXeq3M0gWRB/NMPGW2VuT qKu/GlKnxOa9lwIDNbI/mQs8JXgfzh6LnnToSbiZ4+DEkQnmd5SCUYcZzLhfOxmWhMXs6d S4s8NR4P5d1sqS/qdzqmB//XCU4/RFMlY3h7o0lRd1sbpmHJO5FXi+7wS+7UYK3f3XklwA Eyo3YnvrH5fT59btWqhu/n9hG3I/6GBXjgeUZoRPpNSMZtIVJKjYGbPjzatCA8H4EgQ1IP feLfJfu37lBThUtzJgrBHhuGba3AnW0WEX8g1IvoFBl0ivF5zeOKP9mtDfhsPA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=DnnxMZhE; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699110314; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=FO8t4eAIs9OvtogQZXBUVnZOI9blJVsGV13FOSwyPEI=; b=pvr0W32akVCsDlJ6tIl/ynYyGpcAm7gfCOpriHRD1TeHauteKy4HF2rqXnuMSGjRLkuK3p QKxEqpb2Avy0OpghiBPzBkUqmc/XIv8xWwU50WSSDyreHIC/YRx398ATSSs6Nf3WqdterZ f317IXkPTkiJn8OxdlZnKwFd/Ia1L3PFBfmWK7052OGR96yXmmrdVTxIwRaAp65crb7D7t WrOv6dduhP5Nm2C9mjVGzR0ZbZUC9yUWMbHPymL9sNg28kUr4lxBs/SAp/9jxcsly0VXue yxYJEbYG34/HHr6RLi9WmMSMXdYYKr9Qa0WG394bCqQp3FQaIyv1v8+eNJ3nxg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzICN-0008Jg-OR; Sat, 04 Nov 2023 11:04:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qzICK-0008Im-Gd for guix-patches@gnu.org; Sat, 04 Nov 2023 11:04:28 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qzICK-0006uf-8l for guix-patches@gnu.org; Sat, 04 Nov 2023 11:04:28 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qzICu-0005L5-EA for guix-patches@gnu.org; Sat, 04 Nov 2023 11:05:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66929] [PATCH 07/10] gnu: Add python-accupy. Resent-From: Felix Gruber Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 04 Nov 2023 15:05:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66929@debbugs.gnu.org Cc: Felix Gruber Received: via spool by 66929-submit@debbugs.gnu.org id=B66929.169911025820387 (code B ref 66929); Sat, 04 Nov 2023 15:05:04 +0000 Received: (at 66929) by debbugs.gnu.org; 4 Nov 2023 15:04:18 +0000 Received: from localhost ([127.0.0.1]:35548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzIC9-0005Ij-4c for submit@debbugs.gnu.org; Sat, 04 Nov 2023 11:04:18 -0400 Received: from mout02.posteo.de ([185.67.36.66]:56655) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzIC6-0005I9-QW for 66929@debbugs.gnu.org; Sat, 04 Nov 2023 11:04:16 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id F3A83240101 for <66929@debbugs.gnu.org>; Sat, 4 Nov 2023 16:03:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1699110213; bh=AsFlr+joXi+nCOl0jytILFqIvtDnl3IkEOT+Ism96G4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=DnnxMZhEhy894Vb2PUIQ5I8iYgRDrZKUDM9eEluW6jYqZR86BBSYLji+OCFqgw7Na nIg+O8F7Gqivk8N7uhq/gCnxnVbnBZt284Eb0u2CuOX2zbNWi/AiqUEE2QANGIpbdO B23CCjcC9dLwHLM7S1caMbHCSVho19gwZu0f04i+kYqBX/TooVuX/hoIRn4Couy4// ZlnizxUn7+qA1wKcHJgFYgGfJXqooRfxGybG9BwRzGWpURrV/U8bSdAtrxwpSwTo1+ /aVzLbbBCftgVxQryq0kY/p9iDqCDQ3A9b7WZ5abx0rltwk74DRvG4yW+PU62hU+eF +oOQ91ngihoGQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SN18N45cgz6twg; Sat, 4 Nov 2023 16:03:32 +0100 (CET) From: Felix Gruber Date: Sat, 4 Nov 2023 15:02:36 +0000 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 39EF317341 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -4.21 X-Spam-Score: -4.21 X-TUID: wMHHgHprAvLy * gnu/packages/maths.scm (python-accupy): New variable. * gnu/packages/patches/python-accupy-fix-use-of-perfplot.patch: New file. * gnu/packages/patches/python-accupy-use-matplotx.patch: New file. * gnu/local.mk (dist_patch_DATA): Add new patch files. Change-Id: I0222665d54a36830844b3b33e3dcb546741cfaa1 --- gnu/local.mk | 4 +- gnu/packages/maths.scm | 41 +++++++ .../python-accupy-fix-use-of-perfplot.patch | 48 ++++++++ .../patches/python-accupy-use-matplotx.patch | 113 ++++++++++++++++++ 4 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/python-accupy-fix-use-of-perfplot.patch create mode 100644 gnu/packages/patches/python-accupy-use-matplotx.patch diff --git a/gnu/local.mk b/gnu/local.mk index 8d817379a7..3fbdc3ee9d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -31,7 +31,7 @@ # Copyright © 2020 R Veera Kumar # Copyright © 2020 Nicolò Balzarotti # Copyright © 2020 Michael Rohleder -# Copyright © 2020, 2021, 2022 Felix Gruber +# Copyright © 2020, 2021, 2022, 2023 Felix Gruber # Copyright © 2020 Ryan Prior # Copyright © 2020 Jan Wielkiewicz # Copyright © 2020, 2021 Brice Waegeneire @@ -1753,6 +1753,8 @@ dist_patch_DATA = \ %D%/packages/patches/prusa-slicer-fix-tests.patch \ %D%/packages/patches/prusa-slicer-with-cereal-1.3.1.patch \ %D%/packages/patches/pthreadpool-system-libraries.patch \ + %D%/packages/patches/python-accupy-use-matplotx.patch \ + %D%/packages/patches/python-accupy-fix-use-of-perfplot.patch \ %D%/packages/patches/python-chai-drop-python2.patch \ %D%/packages/patches/python-docrepr-fix-tests.patch \ %D%/packages/patches/python-feedparser-missing-import.patch \ diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index ed1708c77b..28e023190f 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -3648,6 +3648,47 @@ (define-public python-kiwisolver savings are consistently > 5x.") (license license:bsd-3))) +(define-public python-accupy + (package + (name "python-accupy") + (version "0.3.6") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/diego-hayashi/accupy") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0sxkwpp2xy2jgakhdxr4nh1cspqv8l89kz6s832h05pbpyc0n767")) + (patches (search-patches "python-accupy-use-matplotx.patch" + "python-accupy-fix-use-of-perfplot.patch")))) + (build-system pyproject-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'set-eigen-include-dir + (lambda _ + (substitute* "setup.py" + (("include_dirs=\\[\"\\/usr\\/include\\/eigen3\\/\"\\]," _) + (string-append "include_dirs=[\"" + #$(file-append (this-package-input "eigen") + "/include/eigen3/") + "\"],")))))))) + (propagated-inputs (list eigen python-mpmath python-pyfma)) + (native-inputs (list pybind11 + python-matplotx + python-perfplot + python-pytest)) + (home-page "https://github.com/diego-hayashi/accupy") + (synopsis "Accurate calculation of sums and dot products") + (description + "@code{accupy} is a Python library for accurately computing sums +and (dot) products. It implements Kahan summation, Shewchuck's +algorithm and summation in K-fold precision.") + (license license:gpl3))) + (define-public slepc (package (name "slepc") diff --git a/gnu/packages/patches/python-accupy-fix-use-of-perfplot.patch b/gnu/packages/patches/python-accupy-fix-use-of-perfplot.patch new file mode 100644 index 0000000000..5b874e0056 --- /dev/null +++ b/gnu/packages/patches/python-accupy-fix-use-of-perfplot.patch @@ -0,0 +1,48 @@ +From 567558a4eb9b73ab30f9e469b36091eccf445f80 Mon Sep 17 00:00:00 2001 +From: Felix Gruber +Date: Sun, 23 Apr 2023 16:48:59 +0200 +Subject: [PATCH] Fix use of perfplot. + +data tuples are unpacked by perfplot before it calls the kernel +functions. +--- + tests/test_dot.py | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/tests/test_dot.py b/tests/test_dot.py +index a8160fe..51307ad 100644 +--- a/tests/test_dot.py ++++ b/tests/test_dot.py +@@ -76,10 +76,10 @@ def test_speed_comparison1(n_range=None): + perfplot.plot( + setup=lambda n: (np.random.rand(n, 100), np.random.rand(100, n)), + kernels=[ +- lambda xy: np.dot(*xy), +- lambda xy: accupy.kdot(*xy, K=2), +- lambda xy: accupy.kdot(*xy, K=3), +- lambda xy: accupy.fdot(*xy), ++ lambda x, y: np.dot(x, y), ++ lambda x, y: accupy.kdot(x, y, K=2), ++ lambda x, y: accupy.kdot(x, y, K=3), ++ lambda x, y: accupy.fdot(x, y), + ], + labels=["np.dot", "accupy.kdot[2]", "accupy.kdot[3]", "accupy.fdot"], + n_range=n_range, +@@ -96,10 +96,10 @@ def test_speed_comparison2(n_range=None): + perfplot.plot( + setup=lambda n: (np.random.rand(100, n), np.random.rand(n, 100)), + kernels=[ +- lambda xy: np.dot(*xy), +- lambda xy: accupy.kdot(*xy, K=2), +- lambda xy: accupy.kdot(*xy, K=3), +- lambda xy: accupy.fdot(*xy), ++ lambda x, y: np.dot(x, y), ++ lambda x, y: accupy.kdot(x, y, K=2), ++ lambda x, y: accupy.kdot(x, y, K=3), ++ lambda x, y: accupy.fdot(x, y), + ], + labels=["np.dot", "accupy.kdot[2]", "accupy.kdot[3]", "accupy.fdot"], + n_range=n_range, +-- +2.39.2 + diff --git a/gnu/packages/patches/python-accupy-use-matplotx.patch b/gnu/packages/patches/python-accupy-use-matplotx.patch new file mode 100644 index 0000000000..f3dd17da22 --- /dev/null +++ b/gnu/packages/patches/python-accupy-use-matplotx.patch @@ -0,0 +1,113 @@ +From 1da1ed24cfba8a051b6c2f452a67ebfee77ca040 Mon Sep 17 00:00:00 2001 +From: Felix Gruber +Date: Sun, 23 Apr 2023 15:42:19 +0200 +Subject: [PATCH] Use dufte style from matplotx. + +The stand-alone dufte package has been deprecated in favor of the dufte +style that has been integrated into matplotx. +--- + tests/test_dot.py | 10 +++++----- + tests/test_sums.py | 12 ++++++------ + tox.ini | 2 +- + 3 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/tests/test_dot.py b/tests/test_dot.py +index 0a40a0c..a8160fe 100644 +--- a/tests/test_dot.py ++++ b/tests/test_dot.py +@@ -1,5 +1,5 @@ +-import dufte + import matplotlib.pyplot as plt ++import matplotx + import numpy as np + import perfplot + import pytest +@@ -33,7 +33,7 @@ def test_fdot(cond): + + + def test_accuracy_comparison_illcond(target_cond=None): +- plt.style.use(dufte.style) ++ plt.style.use(matplotx.styles.dufte) + + if target_cond is None: + target_cond = [10 ** k for k in range(2)] +@@ -61,13 +61,13 @@ def test_accuracy_comparison_illcond(target_cond=None): + for label, d in zip(labels, data.T): + plt.loglog(condition_numbers, d, label=label) + +- dufte.legend() ++ matplotx.line_labels() + plt.xlabel("condition number") +- dufte.ylabel("relative error") ++ matplotx.ylabel_top("relative error") + + + def test_speed_comparison1(n_range=None): +- plt.style.use(dufte.style) ++ plt.style.use(matplotx.styles.dufte) + + if n_range is None: + n_range = [2 ** k for k in range(2)] +diff --git a/tests/test_sums.py b/tests/test_sums.py +index 1c0f6b0..8cd9ddb 100644 +--- a/tests/test_sums.py ++++ b/tests/test_sums.py +@@ -1,5 +1,5 @@ +-import dufte + import matplotlib.pyplot as plt ++import matplotx + import numpy as np + import perfplot + import pytest +@@ -32,7 +32,7 @@ def test_fsum(cond): + + + def test_accuracy_comparison_illcond(target_conds=None): +- plt.style.use(dufte.style) ++ plt.style.use(matplotx.styles.dufte) + + if target_conds is None: + target_conds = [10 ** k for k in range(1, 2)] +@@ -71,14 +71,14 @@ def test_accuracy_comparison_illcond(target_conds=None): + for label, color, d in zip(labels, colors, data.T): + plt.loglog(condition_numbers, d, label=label, color=color) + +- dufte.legend() ++ matplotx.line_labels() + plt.xlabel("condition number") +- dufte.ylabel("relative error") ++ matplotx.ylabel_top("relative error") + # plt.gca().set_aspect(1.3) + + + def test_speed_comparison1(n_range=None): +- plt.style.use(dufte.style) ++ plt.style.use(matplotx.styles.dufte) + + if n_range is None: + n_range = [2 ** k for k in range(2)] +@@ -109,7 +109,7 @@ def test_speed_comparison1(n_range=None): + + + def test_speed_comparison2(n_range=None): +- plt.style.use(dufte.style) ++ plt.style.use(matplotx.styles.dufte) + + if n_range is None: + n_range = [2 ** k for k in range(2)] +diff --git a/tox.ini b/tox.ini +index 79a53ec..524b3bc 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -4,7 +4,7 @@ isolated_build = True + + [testenv] + deps = +- dufte ++ matplotx + perfplot + pytest + pytest-cov +-- +2.39.2 + -- 2.42.0