Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
27ec276b
Commit
27ec276b
authored
7 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test output of Pythran test and give a better name to a test function.
parent
b67bfd5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
tests/run/numpy_pythran.pyx
tests/run/numpy_pythran.pyx
+5
-4
No files found.
tests/run/numpy_pythran.pyx
View file @
27ec276b
...
...
@@ -5,9 +5,9 @@
import
numpy
as
np
cimport
numpy
as
cnp
def
test
():
def
diffuse
():
"""
>>> u =
test
()
>>> u =
diffuse
()
>>> count_non_zero = np.sum(u > 0)
>>> 15000 < count_non_zero < (2**7) * (2**7) or count_non_zero
True
...
...
@@ -15,11 +15,11 @@ def test():
lx
,
ly
=
(
2
**
7
,
2
**
7
)
u
=
np
.
zeros
([
lx
,
ly
],
dtype
=
np
.
double
)
u
[
lx
//
2
,
ly
//
2
]
=
1000.0
diffuse_numpy
(
u
,
500
)
_
diffuse_numpy
(
u
,
500
)
return
u
def
diffuse_numpy
(
cnp
.
ndarray
[
double
,
ndim
=
2
]
u
,
int
N
):
def
_
diffuse_numpy
(
cnp
.
ndarray
[
double
,
ndim
=
2
]
u
,
int
N
):
"""
Apply Numpy matrix for the Forward-Euler Approximation
"""
...
...
@@ -41,6 +41,7 @@ def calculate_tax(cnp.ndarray[double, ndim=1] d):
>>> d = np.random.lognormal(mu, sigma, 10000)
>>> avg = calculate_tax(d)
>>> 0.243 < avg < 0.244 or avg # 0.24342652180085891
True
"""
tax_seg1
=
d
[(
d
>
256303
)]
*
0.45
-
16164.53
tax_seg2
=
d
[(
d
>
54057
)
&
(
d
<=
256303
)]
*
0.42
-
8475.44
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment