Skip to content

Commit

Permalink
Merge pull request #27 from jannikmi/dev version 3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jannikmi authored Jun 14, 2022
2 parents 7d38516 + dbfe56c commit 9b78894
Show file tree
Hide file tree
Showing 22 changed files with 494 additions and 426 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These are supported funding model platforms
github: [MrMinimal64]
github: [jannikmi]
issuehunt: mrminimal64
22 changes: 19 additions & 3 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
push:
branches:
- master
- dev

jobs:
test:
Expand All @@ -22,7 +21,7 @@ jobs:
- "3.7"
- "3.8"
- "3.9"
# - "3.10"
- "3.10"
env:
TOXENV: ${{ matrix.tox-env }}
TOX_SKIP_MISSING_INTERPRETERS: False
Expand All @@ -45,14 +44,26 @@ jobs:

tag_release:
name: tag current release
if: endsWith(github.ref, '/master') == true
if: endsWith(github.ref, '/master')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Fetch version
id: fetch_version
run: echo "::set-output name=version_nr::$(cat VERSION)"

- name: Build a binary wheel and a source tarball
run: |
pip install setuptools wheel
python setup.py sdist bdist_wheel --python-tag py37.py38.py39.py310
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -65,3 +76,8 @@ jobs:
release_name: Release ${{env.VERSION}}
draft: false
prerelease: false

- name: PyPI Publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_DEPLOYMENT_API_KEY }}
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: check-ast # Is it valid Python?
- id: debug-statements # no debugging statements used
Expand All @@ -25,15 +25,15 @@ repos:
- --filter-files

- repo: https://github.com/psf/black
rev: 21.11b1
rev: 22.3.0
hooks:
- id: black
language_version: python3
args:
- --line-length=120

- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [ black==20.8b1 ]
Expand Down Expand Up @@ -65,7 +65,7 @@ repos:
# - id: rstcheck

- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
rev: v2.34.0
hooks:
- id: pyupgrade

Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Changelog

TODOs

* integrate CD PyPI upload into GHA workflow. including authentication...
* run speed and numerical tests with the new C evaluation method!
* Improve tests
* compare poly.num_ops of different factorisations. tests?
Expand Down Expand Up @@ -55,7 +54,16 @@ idea:
probably not worth the effort. more reasonable to just evaluate multiple polynomials in parallel


3.0.0 (2021-12-04)
3.0.2 (2022-06-14)
__________________

* bugfix: optional ``numba`` dependency. numba imports were not optional
* bugfix: create __cache__ dir if not exists
* minor documentation improvements
* bumping dependencies


3.0.1 (2021-12-04)
__________________

ATTENTION: major changes:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ Ready to contribute? Here's how to set up this package for local development.



.. _Github Issues: https://github.com/MrMinimal64/multivar_horner/issues
.. _Github Issues: https://github.com/jannikmi/multivar_horner/issues
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Simple example:
.. code-block:: python
import numpy as np
from multivar_horner.multivar_horner import HornerMultivarPolynomial
from multivar_horner import HornerMultivarPolynomial
# input parameters defining the polynomial
# p(x) = 5.0 + 1.0 x_1^3 x_2^1 + 2.0 x_1^2 x_3^1 + 3.0 x_1^1 x_2^1 x_3^1
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
3.0.2
2 changes: 1 addition & 1 deletion docs/0_getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ and evaluating :math:`p` at a point :math:`x`:
.. code-block:: python
import numpy as np
from multivar_horner.multivar_horner import HornerMultivarPolynomial
from multivar_horner import HornerMultivarPolynomial
coefficients = np.array([[5.0], [1.0], [2.0], [3.0]], dtype=np.float64) # shape: (M,1)
exponents = np.array(
Expand Down
6 changes: 3 additions & 3 deletions docs/1_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Usage

.. note::

Also check out the :ref:`API documentation <api>` or the `code <https://github.com/MrMinimal64/multivar_horner>`__.
Also check out the :ref:`API documentation <api>` or the `code <https://github.com/jannikmi/multivar_horner>`__.


Let's look at the example multivariate polynomial:
Expand Down Expand Up @@ -61,7 +61,7 @@ to create a representation of the multivariate polynomial :math:`p` in Horner fa

.. code-block:: python
from multivar_horner.multivar_horner import HornerMultivarPolynomial
from multivar_horner import HornerMultivarPolynomial
horner_polynomial = HornerMultivarPolynomial(coefficients, exponents)
Expand Down Expand Up @@ -108,7 +108,7 @@ it is possible to represent the polynomial without any factorisation (refered to

.. code-block:: python
from multivar_horner.multivar_horner import MultivarPolynomial
from multivar_horner import MultivarPolynomial
polynomial = MultivarPolynomial(coefficients, exponents)
Expand Down
48 changes: 48 additions & 0 deletions multivar_horner/_numba_replacements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
""" 'transparent' numba functionality replacements
njit decorator
data types
dtype_2int_tuple = typeof((1, 1))
@njit(b1(i4, i4, i4[:, :]), cache=True)
@njit(dtype_2int_tuple(f8, f8), cache=True)
"""


def njit(*args, **kwargs):
def wrapper(f):
return f

return wrapper


class SubscriptAndCallable(object):
def __init__(self, *args, **kwargs):
pass

def __class_getitem__(cls, item):
return None


# DTYPES
# @njit(b1(i4, i4, i4[:, :]), cache=True)


class b1(SubscriptAndCallable):
pass


class f8(SubscriptAndCallable):
pass


class i8(SubscriptAndCallable):
pass


class u4(SubscriptAndCallable):
pass


class void(SubscriptAndCallable):
pass
4 changes: 1 addition & 3 deletions multivar_horner/classes/horner_poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
OptimalFactorisationRoot,
)
from multivar_horner.classes.helpers import FactorContainer
from multivar_horner.global_settings import BOOL_DTYPE, FLOAT_DTYPE, TYPE_1D_FLOAT, UINT_DTYPE
from multivar_horner.global_settings import BOOL_DTYPE, FLOAT_DTYPE, PATH2CACHE, TYPE_1D_FLOAT, UINT_DTYPE
from multivar_horner.helper_fcts import rectify_query_point, validate_query_point
from multivar_horner.helpers_fcts_numba import eval_recipe

PATH2CACHE = Path(__file__).parent.parent / "__pycache__"


class HornerMultivarPolynomial(AbstractPolynomial):
"""a representation of a multivariate polynomial using Horner factorisation
Expand Down
3 changes: 3 additions & 0 deletions multivar_horner/global_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
from typing import List, Union

import numpy
Expand All @@ -20,3 +21,5 @@

DEBUG = False
# DEBUG = True
PATH2CACHE = Path(__file__).parent.parent / "__pycache__"
PATH2CACHE.mkdir(exist_ok=True)
9 changes: 8 additions & 1 deletion multivar_horner/helpers_fcts_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@


import numpy as np
from numba import b1, f8, i8, njit, u4, void

using_numba = True
try:
from numba import b1, f8, i8, njit, u4, void
except ImportError:
using_numba = False
# replace numba functionality with "transparent" implementations
from multivar_horner._numba_replacements import b1, f8, i8, njit, u4, void

# DTYPES:
F = f8
Expand Down
2 changes: 1 addition & 1 deletion paper/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ @online{github
author = {Michelfeit, Jannik},
title = {multivar_horner},
year = 2018,
url = {https://github.com/MrMinimal64/multivar_horner},
url = {https://github.com/jannikmi/multivar_horner},
urldate = {2020-05-28},
}

Expand Down
4 changes: 2 additions & 2 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ Some intermediate operations to convert the parameters into the required format
# Further reading

The documentation of the package is hosted on [readthedocs.io](https://multivar_horner.readthedocs.io/en/latest/).
Any bugs or feature requests can be filed on [GitHub](https://github.com/MrMinimal64/multivar_horner/issues) [@github].
The [contribution guidelines](https://github.com/MrMinimal64/multivar_horner/blob/master/CONTRIBUTING.rst) can be found there as well.
Any bugs or feature requests can be filed on [GitHub](https://github.com/jannikmi/multivar_horner/issues) [@github].
The [contribution guidelines](https://github.com/jannikmi/multivar_horner/blob/master/CONTRIBUTING.rst) can be found there as well.

The underlying basic mathematical concepts are explained in numerical analysis textbooks like [@neumaier2001introduction].
The Horner scheme at the core of `multivar_horner` has been theoretically outlined in [@greedyHorner].
Expand Down
Loading

0 comments on commit 9b78894

Please sign in to comment.