-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use C-order arrays where possible in numba extension types (#364)
Previously only A-order arrays were used. F-order arrays are not relevant, because coefficient arrays are 1d, and therefore either contiguous and C-order, or not-contiguous and therefore not F-order. Closes #363, allowing multivector constants to be used in cached functions; only C-order arrays are considered candidates for caching, so previously this did not work.
- Loading branch information
1 parent
599abf8
commit 31651d0
Showing
4 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import numpy as np | ||
from clifford._numba_utils import generated_jit | ||
import pytest | ||
|
||
|
||
@generated_jit(cache=True) | ||
def foo(x): | ||
from clifford.g3 import e3 | ||
|
||
def impl(x): | ||
return (x * e3).value | ||
return impl | ||
|
||
|
||
# Make the test fail on a failed cache warning | ||
@pytest.mark.filterwarnings("error") | ||
def test_function_cache(): | ||
from clifford.g3 import e3 | ||
np.testing.assert_array_equal((1.0*e3).value, foo(1.0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters