math/py-pyaudi: New port: Library implementing the algebra of Taylor polynomials

This commit is contained in:
Yuri Victorovich 2023-01-16 23:56:19 -08:00
parent 3403f85ef6
commit 8bd99875f2
7 changed files with 108 additions and 0 deletions

View File

@ -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

45
math/py-pyaudi/Makefile Normal file
View File

@ -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>

3
math/py-pyaudi/distinfo Normal file
View File

@ -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

View File

@ -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")

View File

@ -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

3
math/py-pyaudi/pkg-descr Normal file
View File

@ -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.).

4
math/py-pyaudi/pkg-plist Normal file
View File

@ -0,0 +1,4 @@
%%PYTHON_SITELIBDIR%%/pyaudi/__init__.py
%%PYTHON_SITELIBDIR%%/pyaudi/_version.py
%%PYTHON_SITELIBDIR%%/pyaudi/core.so
%%PYTHON_SITELIBDIR%%/pyaudi/test.py