- Notifications
You must be signed in to change notification settings - Fork15
Remove expired deprecation of using scipy matrix#393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| # These tests are very slow, since they force creation of all | ||
| # numpy unary, binary, monoid, and semiring objects. | ||
| import itertools | ||
| import sys | ||
| import numpy as np | ||
| import pytest | ||
| @@ -10,11 +11,14 @@ | ||
| import graphblas.monoid.numpy as npmonoid | ||
| import graphblas.semiring.numpy as npsemiring | ||
| import graphblas.unary.numpy as npunary | ||
| from graphblas import Vector, backend | ||
| from graphblas.dtypes import _supports_complex | ||
| from .conftest import compute | ||
| is_win = sys.platform.startswith("win") | ||
| suitesparse = backend == "suitesparse" | ||
| def test_numpyops_dir(): | ||
| assert "exp2" in dir(npunary) | ||
| @@ -61,6 +65,11 @@ def test_npunary(): | ||
| "INT64": {"reciprocal"}, | ||
| "FC64": {"ceil", "floor", "trunc"}, | ||
| } | ||
| if suitesparse and is_win: | ||
| # asin and asinh are known to be wrong in SuiteSparse:GraphBLAS | ||
| # due to limitation of MSVC with complex | ||
| blocklist["FC64"].update({"asin", "asinh"}) | ||
| blocklist["FC32"] = {"asin", "asinh"} | ||
Comment on lines +71 to +72 MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I don't know if we strictly need to exclude | ||
| isclose = gb.binary.isclose(1e-6, 0) | ||
| for gb_input, np_input in data: | ||
| for unary_name in sorted(npunary._unary_names): | ||
| @@ -148,18 +157,22 @@ def test_npbinary(): | ||
| gb_left.dtype.name, () | ||
| ): | ||
| continue | ||
| ifis_win and binary_name == "ldexp": | ||
| # On Windows, the second argument must be int32 or less (I'm not sure why) | ||
| np_right = np_right.astype(np.int32) | ||
| with np.errstate(divide="ignore", over="ignore", under="ignore", invalid="ignore"): | ||
| gb_result = gb_left.ewise_mult(gb_right, op).new() | ||
| try: | ||
| if gb_left.dtype == "BOOL" and gb_result.dtype == "FP32": | ||
| np_result = getattr(np, binary_name)(np_left, np_right, dtype="float32") | ||
| compare_op = isclose | ||
| else: | ||
| np_result = getattr(np, binary_name)(np_left, np_right) | ||
| compare_op = npbinary.equal | ||
| except Exception: # pragma: no cover (debug) | ||
| print(f"Error computing numpy result for {binary_name}") | ||
| print(f"dtypes: ({gb_left.dtype}, {gb_right.dtype}) -> {gb_result.dtype}") | ||
| raise | ||
| np_result = Vector.from_coo(np.arange(np_left.size), np_result, dtype=gb_result.dtype) | ||
| assert gb_result.nvals == np_result.size | ||