Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arraycontext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
arraycontext
Commits
cced8d55
Commit
cced8d55
authored
3 years ago
by
Matthias Diener
Browse files
Options
Downloads
Patches
Plain Diff
some test fixes
parent
7f1455d9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_arraycontext.py
+23
-5
23 additions, 5 deletions
test/test_arraycontext.py
with
23 additions
and
5 deletions
test/test_arraycontext.py
+
23
−
5
View file @
cced8d55
...
...
@@ -252,7 +252,7 @@ def test_dof_array_arithmetic_same_as_numpy(actx_factory):
return
ary
.
real
def
get_imag
(
ary
):
return
ary
.
real
return
ary
.
real
# FIXME?
import
operator
from
pytools
import
generate_nonnegative_integer_tuples_below
as
gnitb
...
...
@@ -294,8 +294,9 @@ def test_dof_array_arithmetic_same_as_numpy(actx_factory):
(
operator
.
neg
,
1
,
False
),
(
operator
.
abs
,
1
,
False
),
(
get_real
,
1
,
False
),
(
get_imag
,
1
,
False
),
# Not supported in pytato:
# (get_real, 1, False),
# (get_imag, 1, False),
]:
for
is_array_flags
in
gnitb
(
2
,
n_args
):
if
sum
(
is_array_flags
)
==
0
:
...
...
@@ -310,6 +311,23 @@ def test_dof_array_arithmetic_same_as_numpy(actx_factory):
# can't do in place operations with a scalar lhs
continue
if
op_func
==
operator
.
ge
:
op_func_actx
=
actx
.
np
.
greater_equal
elif
op_func
==
operator
.
lt
:
op_func_actx
=
actx
.
np
.
less
elif
op_func
==
operator
.
gt
:
op_func_actx
=
actx
.
np
.
greater
elif
op_func
==
operator
.
eq
:
op_func_actx
=
actx
.
np
.
equal
elif
op_func
==
operator
.
ne
:
op_func_actx
=
actx
.
np
.
not_equal
elif
op_func
==
get_real
:
op_func_actx
=
actx
.
np
.
real
elif
op_func
==
get_imag
:
op_func_actx
=
actx
.
imag
else
:
op_func_actx
=
op_func
args
=
[
(
0.5
+
np
.
random
.
rand
(
ndofs
)
if
not
use_integers
else
...
...
@@ -338,7 +356,7 @@ def test_dof_array_arithmetic_same_as_numpy(actx_factory):
if
isinstance
(
arg
,
np
.
ndarray
)
else
arg
for
arg
in
args
]
actx_result
=
actx
.
to_numpy
(
op_func
(
*
actx_args
)[
0
])
actx_result
=
actx
.
to_numpy
(
op_func
_actx
(
*
actx_args
)[
0
])
assert
np
.
allclose
(
actx_result
,
ref_result
)
...
...
@@ -370,7 +388,7 @@ def test_dof_array_arithmetic_same_as_numpy(actx_factory):
for
arg
in
actx_args
]
obj_array_result
=
actx
.
to_numpy
(
op_func
(
*
obj_array_args
)[
0
][
0
])
op_func
_actx
(
*
obj_array_args
)[
0
][
0
])
assert
np
.
allclose
(
obj_array_result
,
ref_result
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment