ChebTools

ChebTools: C++11 (and Python) tools for working with Chebyshev expansions - Published in JOSS (2018)

https://github.com/usnistgov/chebtools

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    2 of 7 committers (28.6%) from academic institutions
  • Institutional organization owner
    Organization usnistgov has institutional domain (www.nist.gov)
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords from Contributors

mesh

Scientific Fields

Economics Social Sciences - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

C++ tools for working with Chebyshev expansion interpolants

Basic Info
  • Host: GitHub
  • Owner: usnistgov
  • License: mit
  • Language: C++
  • Default Branch: master
  • Size: 1.17 MB
Statistics
  • Stars: 32
  • Watchers: 9
  • Forks: 9
  • Open Issues: 2
  • Releases: 3
Created about 9 years ago · Last pushed 6 months ago
Metadata Files
Readme License

README.md

ChebTools

Chebyshev-basis expansions, and more broadly, orthogonal polynomial expansions, are commonly used as numerical approximations of continuous functions on closed domains. One of the most successful projects that makes use of the Chebyshev expansions is the chebfun library for MATLAB. Other similar libraries are pychebfun, chebpy, and Approxfun. Our library ChebTools fills a similar niche as that of chebfun -- working with Chebyshev expansions.

The primary motivation for the development of ChebTools is the need for a highly optimized and fast C++11 library for working with Chebyshev expansions. Particularly, in order to approximate numerical functions with well-behaved interpolation functions.

Automatic tests on github actions: build and run tests

Paper about ChebTools in JOSS: DOI

Example:

Try it in your browser: Binder

Suppose we wanted to calculate the roots and extrema of the 0-th Bessel function in [0, 30]. That results in a picture like this:

Roots and extrema of the 0-th Bessel function

For which the Python code would read ``` python import scipy.special import ChebTools

Only keep the roots that are in [-1,1] in scaled coordinates

onlyindomain = True

The 0-th Bessel function (for code concision)

def J0(x): return scipy.special.jn(0,x)

Make a 200-th order expansion of the 0-th Bessel function in [0,30]

f = ChebTools.generateChebyshevexpansion(200, J0, 0, 30)

Roots of the function

rts = f.realroots(onlyin_domain)

Extrema of the function (roots of the derivative, where dy/dx =0)

extrema = f.deriv(1).realroots(onlyin_domain) ```

Changelog

  • 1.1: Added integrate function for indefinite integral
  • 1.2: Added some more operators, including division and unary negation
  • 1.3: Added is_monotonic function to ascertain whether the nodes are monotonically increasing or decreasing
  • 1.4: Added dyadic splitting into intervals (C++ only for now)
  • 1.5: Added FFT-based function for getting expansion coefficient values from nodal values
  • 1.7: Added ChebyshevCollection container class for fast evaluation of collection of expansions (generated from dyadic splitting maybe?)
  • 1.8: Added __version__ attribute
  • 1.9: Added the ability to construct inverse functions
  • 1.10: Added 2D evaluation functions in double and complex<double> options (useful for model optimization with complex step derivatives)
  • 1.10.1: Repaired universal2 binary wheels on Mac
  • 1.11: Exposed get_coef function for Taylor series extrapolator
  • 1.12.0: Switched interface for python to nanobind. Dropped pypy wheels.

License

*MIT licensed (see LICENSE for specifics), not subject to copyright in the USA.

Uses unmodified Eigen for matrix operations

Contributing/Getting Help

If you would like to contribute to ChebTools or report a problem, please open a pull request or submit an issue. Especially welcome would be additional tests.

Installation

Prerequisites

You will need:

  • cmake (on windows, install from cmake, on linux sudo apt install cmake should do it, on OSX, brew install cmake)
  • Python (the anaconda distribution is used by the authors)
  • a compiler (on windows, Visual Studio 2015+ (express version is fine), g++ on linux/OSX)

If on linux you use Anaconda and end up with an error like ImportError: /home/theuser/anaconda3/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/theuser/anaconda3/lib/python3.5/site-packages/ChebTools.cpython-35m-x86_64-linux-gnu.so) it can be sometimes fixed by installing libgcc with conda: conda install libgcc. This is due to an issue in Anaconda

To install in one line from github (easiest)

This will download the sources into a temporary directory and build and install the python extension so long as you have the necessary prerequisites: pip install git+git://github.com/usnistgov/ChebTools.git

From a cloned repository

Alternatively, you can clone (recursively!) and run the setup.py script

git clone --recursive --shallow-submodules https://github.com/usnistgov/ChebTools cd ChebTools python setup.py install

to install, or

python setup.py develop

to use a locally-compiled version for testing. If you want to build a debug version, you can do so with

python setup.py build -g develop With a debug build, you can step into the debugger to debug the C++ code, for instance.

Cmake build

Starting in the root of the repo (a debug build with the default compiler, here on linux):

git clone --recursive --shallow-submodules https://github.com/usnistgov/ChebTools cd ChebTools mkdir build cd build cmake .. cmake --build . For those using Anaconda on Linux, please use the following for cmake: mkdir build cd build cmake .. -DPYTHON_EXECUTABLE=`which python` cmake --build . For Visual Studio 2015 (64-bit) in release mode, you would do: git clone --recursive --shallow-submodules https://github.com/usnistgov/ChebTools cd ChebTools mkdir build cd build cmake .. -G "Visual Studio 14 2015 Win64" cmake --build . --config Release

If you need to update your submodules (pybind11 and friends)

git submodule update --init

For other options, see the cmake docs.

Owner

  • Name: National Institute of Standards and Technology
  • Login: usnistgov
  • Kind: organization
  • Location: Gaithersburg, Md.

Department of Commerce

JOSS Publication

ChebTools: C++11 (and Python) tools for working with Chebyshev expansions
Published
February 12, 2018
Volume 3, Issue 22, Page 569
Authors
Ian H. Bell ORCID
National Institute of Standards and Technology, Boulder, CO, USA
Bradley Alpert ORCID
National Institute of Standards and Technology, Boulder, CO, USA
Lucas Bouck ORCID
National Institute of Standards and Technology, Boulder, CO, USA, George Mason University, Fairfax, VA, USA
Editor
Lorena A Barba ORCID
Tags
Chebyshev mathematical operations

GitHub Events

Total
  • Watch event: 3
  • Delete event: 1
  • Member event: 4
  • Push event: 3
  • Pull request event: 1
  • Fork event: 2
  • Create event: 1
Last Year
  • Watch event: 3
  • Delete event: 1
  • Member event: 4
  • Push event: 3
  • Pull request event: 1
  • Fork event: 2
  • Create event: 1

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 346
  • Total Committers: 7
  • Avg Commits per committer: 49.429
  • Development Distribution Score (DDS): 0.301
Past Year
  • Commits: 29
  • Committers: 3
  • Avg Commits per committer: 9.667
  • Development Distribution Score (DDS): 0.172
Top Committers
Name Email Commits
Ian Bell i****l@n****v 242
Ian Bell i****l@g****m 82
Ian Bell i****l@g****m 16
Lucas Bouck l****k@g****m 3
dependabot[bot] 4****] 1
Shriramana Sharma s****a@g****m 1
LBouck l****k@m****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 8
  • Total pull requests: 27
  • Average time to close issues: 29 days
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 7
  • Total pull request authors: 6
  • Average comments per issue: 6.5
  • Average comments per pull request: 0.3
  • Merged pull requests: 25
  • Bot issues: 0
  • Bot pull requests: 3
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 10 minutes
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • ianhbell (2)
  • cauachagas (1)
  • OrbitalMechanic (1)
  • jamadagni (1)
  • iajzenszmi (1)
  • folrent1896 (1)
Pull Request Authors
  • ianhbell (9)
  • ibell (9)
  • LBouck (4)
  • dependabot[bot] (4)
  • jowr (1)
  • jamadagni (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (4)

Dependencies

.github/workflows/build_wheels.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
.github/workflows/runcatch.yml actions
  • actions/checkout v2 composite
environment.yml pypi
setup.py pypi