Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nschloe/scipyx
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.13
Choose a base ref
...
head repository: nschloe/scipyx
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Apr 28, 2021

  1. fix setup

    nschloe committed Apr 28, 2021
    Copy the full SHA
    99d1e38 View commit details
  2. Merge pull request #5 from nschloe/fix-setup

    fix setup
    nschloe authored Apr 28, 2021
    Copy the full SHA
    8f78542 View commit details

Commits on Apr 30, 2021

  1. use src/ layout

    nschloe committed Apr 30, 2021
    Copy the full SHA
    9dd8420 View commit details
  2. Merge pull request #6 from nschloe/src-layout

    use src/ layout
    nschloe authored Apr 30, 2021
    Copy the full SHA
    2bbeec2 View commit details
  3. actually test qmr

    nschloe committed Apr 30, 2021
    Copy the full SHA
    aba3a2d View commit details
  4. more compact krylov tests

    nschloe committed Apr 30, 2021
    Copy the full SHA
    a73ca10 View commit details
  5. test complex-valued

    nschloe committed Apr 30, 2021
    Copy the full SHA
    635437e View commit details
  6. fix test warning

    nschloe committed Apr 30, 2021
    Copy the full SHA
    14fd699 View commit details
  7. version bump

    nschloe committed Apr 30, 2021
    Copy the full SHA
    d4065d5 View commit details
  8. Merge pull request #7 from nschloe/test-fix

    test fix, treat complex numbers correctly
    nschloe authored Apr 30, 2021
    Copy the full SHA
    8481612 View commit details
  9. some shape fixes

    nschloe committed Apr 30, 2021
    Copy the full SHA
    7b9fe75 View commit details
  10. gitignore

    nschloe committed Apr 30, 2021
    Copy the full SHA
    8769815 View commit details

Commits on May 1, 2021

  1. fix some shape issues

    nschloe committed May 1, 2021
    Copy the full SHA
    674bba0 View commit details
  2. krylov: more assertions

    nschloe committed May 1, 2021
    Copy the full SHA
    d6cdfed View commit details
  3. krylov: dim fixes

    nschloe committed May 1, 2021
    Copy the full SHA
    490af31 View commit details
  4. readme

    nschloe committed May 1, 2021
    Copy the full SHA
    0bd820e View commit details
  5. version bump

    nschloe committed May 1, 2021
    Copy the full SHA
    873ac14 View commit details
  6. krylov: unify shape tests

    nschloe committed May 1, 2021
    Copy the full SHA
    f5774ae View commit details
  7. Merge pull request #8 from nschloe/shape-fix

    shape fixes
    nschloe authored May 1, 2021
    Copy the full SHA
    8cede05 View commit details
  8. coverage fix

    nschloe committed May 1, 2021
    Copy the full SHA
    b7e3d5f View commit details
  9. Merge pull request #9 from nschloe/coverage

    coverage fix
    nschloe authored May 1, 2021
    Copy the full SHA
    e5a3bf0 View commit details

Commits on May 26, 2021

  1. use pytest-codeblocks

    nschloe committed May 26, 2021
    Copy the full SHA
    e70f5eb View commit details
  2. Merge pull request #10 from nschloe/pytest-codeblocks

    use pytest-codeblocks
    nschloe authored May 26, 2021
    Copy the full SHA
    c633140 View commit details

Commits on Sep 2, 2021

  1. make -> just

    nschloe committed Sep 2, 2021
    Copy the full SHA
    fbae68d View commit details
  2. add pre-commit

    nschloe committed Sep 2, 2021
    Copy the full SHA
    4d7c896 View commit details
  3. Copy the full SHA
    7f7fb6b View commit details
  4. fix interpolation

    nschloe committed Sep 2, 2021
    Copy the full SHA
    bde291f View commit details
  5. version bump

    nschloe committed Sep 2, 2021
    Copy the full SHA
    2022084 View commit details
  6. remove __about__

    nschloe committed Sep 2, 2021
    Copy the full SHA
    6626f07 View commit details
  7. fix tests

    nschloe committed Sep 2, 2021
    Copy the full SHA
    84e37ff View commit details
  8. prettier

    nschloe committed Sep 2, 2021
    Copy the full SHA
    6491cda View commit details
  9. test

    nschloe committed Sep 2, 2021
    Copy the full SHA
    4336745 View commit details
  10. remove python 3.7

    nschloe committed Sep 2, 2021
    Copy the full SHA
    f37f703 View commit details
  11. some type annotations

    nschloe committed Sep 2, 2021
    Copy the full SHA
    f6f1f14 View commit details
  12. Merge pull request #12 from nschloe/rolling-lagrange

    Rolling Lagrange interpolation
    nschloe authored Sep 2, 2021
    Copy the full SHA
    080078e View commit details

Commits on Oct 19, 2021

  1. Copy the full SHA
    d38d428 View commit details
  2. ellip: add ph

    nschloe committed Oct 19, 2021
    Copy the full SHA
    fd680d7 View commit details
  3. readme

    nschloe committed Oct 19, 2021
    Copy the full SHA
    8679be9 View commit details
  4. version bump

    nschloe committed Oct 19, 2021
    Copy the full SHA
    be7ebc9 View commit details
  5. Copy the full SHA
    6421a0f View commit details
  6. update pre-commit

    nschloe committed Oct 19, 2021
    Copy the full SHA
    54fb86a View commit details
  7. Merge pull request #13 from nschloe/elliptic-complex

    jacobi elliptic functions with complex argument
    nschloe authored Oct 19, 2021
    Copy the full SHA
    427bd0e View commit details

Commits on Dec 9, 2021

  1. some modernization

    nschloe committed Dec 9, 2021
    Copy the full SHA
    45bdaaf View commit details
  2. version bump

    nschloe committed Dec 9, 2021
    Copy the full SHA
    4202ae7 View commit details
  3. Merge pull request #14 from nschloe/mod

    modernize
    nschloe authored Dec 9, 2021
    Copy the full SHA
    1685430 View commit details

Commits on Jan 29, 2022

  1. Copy the full SHA
    55b2234 View commit details
  2. update year

    nschloe committed Jan 29, 2022
    Copy the full SHA
    886a1b0 View commit details
  3. pyproject.toml

    nschloe committed Jan 29, 2022
    Copy the full SHA
    46f7122 View commit details
  4. add __about__

    nschloe committed Jan 29, 2022
    Copy the full SHA
    48fe8fe View commit details
  5. Merge pull request #15 from nschloe/rm-nonlinear

    move nonlinear funciton to sigma
    nschloe authored Jan 29, 2022
    Copy the full SHA
    63e7850 View commit details
46 changes: 20 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -3,42 +3,36 @@ name: ci
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: actions/checkout@v2
- name: Lint with flake8
run: |
pip install flake8
flake8 .
- name: Lint with black
run: |
pip install black
black --check .
- name: Check out repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Run pre-commit
uses: pre-commit/action@v2.0.3

build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Test with tox
run: |
pip install tox
tox
- name: Submit to codecov
uses: codecov/codecov-action@v1
if: ${{ matrix.python-version == '3.9' }}
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Test with tox
run: |
pip install tox
tox -- --cov scipyx --cov-report xml --cov-report term
- name: Submit to codecov
uses: codecov/codecov-action@v1
if: ${{ matrix.python-version == '3.9' }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -8,3 +8,4 @@ build/
.cache/
*.egg-info/
.pytest_cache/
.tox/
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 21.9b0
hooks:
- id: black
language_version: python3

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 Nico Schlömer
Copyright 2021-2022 Nico Schlömer

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
35 changes: 0 additions & 35 deletions Makefile

This file was deleted.

60 changes: 45 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ If you have a fix for a SciPy method that can't go upstream for some reason, fee
to PR here.

#### Krylov methods

```python
import numpy as np
import scipy.sparse
@@ -43,16 +44,19 @@ sol, info = spx.bicgstab(A, b, tol=1.0e-10)
sol, info = spx.cgs(A, b, tol=1.0e-10)
sol, info = spx.qmr(A, b, tol=1.0e-10)
```

`sol` is the solution of the linear system `A @ x = b` (or `None` if no convergence),
and `info` contains some useful data, e.g., `info.resnorms`. The methods are wrappers
around [SciPy's iterative
and `info` contains some useful data, e.g., `info.resnorms`. The solution `sol` and all
callback `x` have the shape of `x0`/`b`.
The methods are wrappers around [SciPy's iterative
solvers](https://docs.scipy.org/doc/scipy/reference/sparse.linalg.html).

Relevant issues:
* [inconsistent number of callback calls between cg, minres](https://github.com/scipy/scipy/issues/13936)

- [inconsistent number of callback calls between cg, minres](https://github.com/scipy/scipy/issues/13936)

#### Optimization

```python
import scipyx as spx

@@ -69,35 +73,61 @@ x0 = -3.2
x, _ = spx.leastsq(f, x0)
print(x)
```

In scipyx, all intermediate values `x` and the result from a minimization `out.x` will
have the same shape as `x0`. (In SciPy, they always have shape `(n,)`, no matter the
input vector.)

Relevant issues:

* [optimization: let out.x have the same shape as
x0](https://github.com/scipy/scipy/issues/13869)
- [optimization: let out.x have the same shape as
x0](https://github.com/scipy/scipy/issues/13869)


#### Rolling Lagrange interpolation

#### Root-finding
```python
import numpy as np
import scipyx as spx


def f(x):
return x ** 2 - 2
x = np.linspace(0.0, 1.0, 11)
y = np.sin(7.0 * x)

poly = spx.interp_rolling_lagrange(x, y, order=3)
```

Given an array of coordinates `x` and an array of values `y`, you can use scipyx to
compute a piecewise polynomial Lagrange approximation. The `order + 1` closest
coordinates x/y are considered for each interval.

a, b = spx.bisect(f, 0.0, 5.0, tol=1.0e-12)
a, b = spx.regula_falsi(f, 0.0, 5.0, tol=1.0e-12)
| <img src="https://nschloe.github.io/scipyx/interp-0.svg" width="100%"> | <img src="https://nschloe.github.io/scipyx/interp-1.svg" width="100%"> | <img src="https://nschloe.github.io/scipyx/interp-2.svg" width="100%"> |
| :--------------------------------------------------------------------: | :--------------------------------------------------------------------: | :--------------------------------------------------------------------: |
| Order 0 | Order 1 | Order 2 |

#### Jacobi elliptic functions with complex argument

SciPy supports
[Jacobi elliptic functions](https://en.wikipedia.org/wiki/Jacobi_elliptic_functions) as
[ellipj](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipj.html).
Unfortunately, only real-valued argument `u` and parameter `m` are allowed. scipyx
expands support to complex-valued argument `u`.

```python
import scipyx as spx

u = 1.0 + 2.0j
m = 0.8
# sn, cn, dn, ph = scipy.special.ellipj(x, m) # not working
sn, cn, dn, ph = spx.ellipj(u, m)
```
scipyx provides some basic nonlinear root-findings algorithms:
[bisection](https://en.wikipedia.org/wiki/Bisection_method) and [regula
falsi](https://en.wikipedia.org/wiki/Regula_falsi). They're not as fast-converging as
[other methods](https://en.wikipedia.org/wiki/Newton%27s_method), but are very robust
and work with almost any function.

Relevant bug reports:

- [Jacobian elliptic function with complex argument
#12226](https://github.com/scipy/scipy/issues/12226)

### License

This software is published under the [BSD-3-Clause
license](https://spdx.org/licenses/BSD-3-Clause.html).
22 changes: 22 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version := `python3 -c "from src.scipyx.__about__ import __version__; print(__version__)"`

default:
@echo "\"just publish\"?"

publish:
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
gh release create "v{{version}}"
flit publish

clean:
@find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
@rm -rf src/*.egg-info/ build/ dist/ .tox/

format:
isort .
black .
blacken-docs README.md

lint:
black --check .
flake8 .
39 changes: 37 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[tool.isort]
profile = "black"

[project]
name = "scipyx"
authors = [{name = "Nico Schlömer", email = "nico.schloemer@gmail.com"}]
description = "SciPy fixes and extensions"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
"Topic :: Utilities",
]
dynamic = ["version"]
requires-python = ">=3.7"
dependencies = [
"numpy >= 1.20.0",
"scipy",
]

[project.urls]
Code = "https://github.com/nschloe/scipyx"
Issues = "https://github.com/nschloe/scipyx/issues"
Funding = "https://github.com/sponsors/nschloe"
10 changes: 0 additions & 10 deletions scipyx/__about__.py

This file was deleted.

91 changes: 0 additions & 91 deletions scipyx/_nonlinear.py

This file was deleted.

Loading