git: 8bd99875f247 - main - math/py-pyaudi: New port: Library implementing the algebra of Taylor polynomials

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 17 Jan 2023 07:58:50 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8bd99875f247b39eb434bb43b699ee9deb05d197

commit 8bd99875f247b39eb434bb43b699ee9deb05d197
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-01-17 07:56:19 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-01-17 07:58:44 +0000

    math/py-pyaudi: New port: Library implementing the algebra of Taylor polynomials
---
 math/Makefile                             |  1 +
 math/py-pyaudi/Makefile                   | 45 +++++++++++++++++++++++++++++++
 math/py-pyaudi/distinfo                   |  3 +++
 math/py-pyaudi/files/patch-CMakeLists.txt | 13 +++++++++
 math/py-pyaudi/files/test.py              | 39 +++++++++++++++++++++++++++
 math/py-pyaudi/pkg-descr                  |  3 +++
 math/py-pyaudi/pkg-plist                  |  4 +++
 7 files changed, 108 insertions(+)

diff --git a/math/Makefile b/math/Makefile
index fdb34be568b9..6e6adc82c966 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -977,6 +977,7 @@
     SUBDIR += py-primecountpy
     SUBDIR += py-primme
     SUBDIR += py-pyFFTW
+    SUBDIR += py-pyaudi
     SUBDIR += py-pybloom
     SUBDIR += py-pyclipper
     SUBDIR += py-pycosat
diff --git a/math/py-pyaudi/Makefile b/math/py-pyaudi/Makefile
new file mode 100644
index 000000000000..eebd49d88c90
--- /dev/null
+++ b/math/py-pyaudi/Makefile
@@ -0,0 +1,45 @@
+PORTNAME=	pyaudi
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.9.2-1
+DISTVERSIONSUFFIX=	-g899eb78
+CATEGORIES=	math
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Library implementing the algebra of Taylor polynomials
+WWW=		http://darioizzo.github.io/audi/
+
+LICENSE=	GPLv2
+LICENSE_FILE=	${WRKSRC}/../LICENSE
+
+BUILD_DEPENDS=	audi>0:math/audi \
+		pybind11>0:devel/pybind11
+LIB_DEPENDS=	libabsl_base.so:devel/abseil \
+		libboost_serialization.so:devel/boost-libs \
+		libfmt.so:devel/libfmt \
+		libgmp.so:math/gmp \
+		libmp++.so:math/mppp \
+		libmpc.so:math/mpc \
+		libmpfr.so:math/mpfr \
+		libobake.so:math/obake \
+		libtbb.so:devel/onetbb
+
+USES=		cmake:testing compiler:c++20-lang python
+USE_PYTHON=	flavors
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	darioizzo
+GH_PROJECT=	audi
+
+WRKSRC_SUBDIR=	pyaudi
+
+CMAKE_OFF=	AUDI_BUILD_TESTS
+CMAKE_ARGS=	-DPYTHON_VERSION_MAJOR=3
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+do-test:
+	@${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/test.py
+
+.include <bsd.port.mk>
diff --git a/math/py-pyaudi/distinfo b/math/py-pyaudi/distinfo
new file mode 100644
index 000000000000..dbcbd034d742
--- /dev/null
+++ b/math/py-pyaudi/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1673910095
+SHA256 (darioizzo-audi-v1.9.2-1-g899eb78_GH0.tar.gz) = 984297ae749165725cf79245f34079867660999c09bee2c181ed3509a337ddcb
+SIZE (darioizzo-audi-v1.9.2-1-g899eb78_GH0.tar.gz) = 494328
diff --git a/math/py-pyaudi/files/patch-CMakeLists.txt b/math/py-pyaudi/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..4509ec5ec8db
--- /dev/null
+++ b/math/py-pyaudi/files/patch-CMakeLists.txt
@@ -0,0 +1,13 @@
+--- CMakeLists.txt.orig	2023-01-17 00:20:58 UTC
++++ CMakeLists.txt
+@@ -1,3 +1,10 @@
++
++cmake_minimum_required(VERSION 3.8)
++
++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake_modules" "${CMAKE_SOURCE_DIR}/../cmake_modules/yacma")
++
++include(YACMAPythonSetup)
++
+ # Python version check.
+ if(${PYTHON_VERSION_MAJOR} LESS 3)
+     message(FATAL_ERROR "Minimum supported Python version is 3.0")
diff --git a/math/py-pyaudi/files/test.py b/math/py-pyaudi/files/test.py
new file mode 100644
index 000000000000..a88096364d54
--- /dev/null
+++ b/math/py-pyaudi/files/test.py
@@ -0,0 +1,39 @@
+# from http://darioizzo.github.io/audi/notebooks/example00.html
+
+from pyaudi import gdual_double as gdual
+from pyaudi import sin, cos, tan
+
+# Define some variables (gduals)
+x,y,z = [gdual(0.,_,3) for _ in "xyz"]
+
+# Create a function of these variables
+f = x*x+2*tan(x/(y+1))-sin(z)
+print(f)
+
+# Extracting the derivatives
+print(f.get_derivative([0,0,1]))
+print(f.get_derivative({"dz": 1}))
+print(f.get_derivative({"dx":1, "dy":1}))
+
+# Changing the point
+x = gdual(1.,"x",3)
+y = gdual(2.,"y",3)
+z = gdual(3.,"z",3)
+f = x*x+2*tan(x/(y+1))-sin(z)
+print(f)
+
+print(f.get_derivative([0,0,1]))
+
+print(-cos(3.))
+
+# Encapsulating f in a function call
+
+def f(x,y,z):
+    return x*x+2*tan(x/(y+1))-sin(z)
+
+
+x = gdual(1.,"x",3)
+y = gdual(2.,"y",3)
+z = gdual(3.,"z",3)
+print(f(x,y,z)) #Call with gduals
+print(f(1.,2.,3.))     #Call with floats
diff --git a/math/py-pyaudi/pkg-descr b/math/py-pyaudi/pkg-descr
new file mode 100644
index 000000000000..5191cf320c9c
--- /dev/null
+++ b/math/py-pyaudi/pkg-descr
@@ -0,0 +1,3 @@
+obake is a C++ computer algebra library for the symbolic manipulation of sparse
+multivariate polynomials and other closely-related symbolic objects (such as
+truncated power series, Poisson series, etc.).
diff --git a/math/py-pyaudi/pkg-plist b/math/py-pyaudi/pkg-plist
new file mode 100644
index 000000000000..4b3dad9d2cd8
--- /dev/null
+++ b/math/py-pyaudi/pkg-plist
@@ -0,0 +1,4 @@
+%%PYTHON_SITELIBDIR%%/pyaudi/__init__.py
+%%PYTHON_SITELIBDIR%%/pyaudi/_version.py
+%%PYTHON_SITELIBDIR%%/pyaudi/core.so
+%%PYTHON_SITELIBDIR%%/pyaudi/test.py