Revision bd70db79eff31b1d953117fc73898c68f1d6860e authored by Mathis Gerdes on 10 April 2020, 06:16:53 UTC, committed by GitHub on 10 April 2020, 06:16:53 UTC
* Implement np.roots.

* Expose jit-compatible variant of np.roots.

General np.roots implementation has a value dependent output shape.
If the input coefficients are guaranteed to have no leading zeros,
output shape is independent of values. Skip checking for leading
zeros by setting a keyword argument.

* Fix typo.

* Make roots jit-argument keyword only.

Co-Authored-By: Stephan Hoyer <shoyer@google.com>

* Format docstring to enable parsing.

Co-Authored-By: Stephan Hoyer <shoyer@google.com>

* Add np.roots function to documentation.

* Add more tests for np.roots function.

- Include length 0 polynomial coefficients
- Test strip_zeros=False argument
- Test jit compiled version (only on cpu due to eigvals)
- Confirm that adding leading zeros while skipping check
  for them results in nan's (expected behavior)

* Fix bug in np.roots test.

The polynomial with coefficents [0] never fails because the number of
roots is 0.

* Avoid bug in eigvals and adjust test accuracy.

The parameters of the test that was changed are non-essential
since they test for how the code behaves given invalid inputs.

The accuracy in comparing to the numpy result is changed because
the algorithm in those cases is slightly changed with respect to
the original numpy algorithm (to allow jit).

Co-authored-by: Stephan Hoyer <shoyer@google.com>
1 parent 65692db
History
File Mode Size
benchmarks
build
cloud_tpu_colabs
design_notes
docs
examples
images
jax
jaxlib
tests
.gitignore -rw-r--r-- 183 bytes
.readthedocs.yml -rw-r--r-- 504 bytes
.travis.yml -rw-r--r-- 1.9 KB
CHANGELOG.md -rw-r--r-- 92 bytes
CONTRIBUTING.md -rw-r--r-- 581 bytes
LICENSE -rw-r--r-- 11.1 KB
LICENSE_SHORT -rw-r--r-- 575 bytes
README.md -rw-r--r-- 19.5 KB
WORKSPACE -rw-r--r-- 2.4 KB
mypy.ini -rw-r--r-- 292 bytes
pylintrc -rw-r--r-- 1.6 KB
setup.py -rw-r--r-- 1.1 KB

README.md

back to top