Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
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
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephan Seitz
pystencils
Commits
db4e5a86
Commit
db4e5a86
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Avoid optimizations of IntegerFunctionTwoArgsMixIn
parent
55a6acd8
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
pystencils/math_optimizations.py
+6
-1
6 additions, 1 deletion
pystencils/math_optimizations.py
with
6 additions
and
1 deletion
pystencils/math_optimizations.py
+
6
−
1
View file @
db4e5a86
...
@@ -9,6 +9,7 @@ import itertools
...
@@ -9,6 +9,7 @@ import itertools
from
pystencils
import
Assignment
from
pystencils
import
Assignment
from
pystencils.astnodes
import
SympyAssignment
from
pystencils.astnodes
import
SympyAssignment
from
pystencils.integer_functions
import
IntegerFunctionTwoArgsMixIn
try
:
try
:
from
sympy.codegen.rewriting
import
optims_c99
,
optimize
from
sympy.codegen.rewriting
import
optims_c99
,
optimize
...
@@ -24,6 +25,9 @@ try:
...
@@ -24,6 +25,9 @@ try:
optims_pystencils_cpu
=
[
evaluate_constant_terms
]
+
list
(
optims_c99
)
optims_pystencils_cpu
=
[
evaluate_constant_terms
]
+
list
(
optims_c99
)
optims_pystencils_gpu
=
[
evaluate_constant_terms
]
+
list
(
optims_c99
)
optims_pystencils_gpu
=
[
evaluate_constant_terms
]
+
list
(
optims_c99
)
except
ImportError
:
except
ImportError
:
from
warnings
import
warn
warn
(
"
Could not import ReplaceOptim, optims_c99, optimize from sympy.codegen.rewriting.
"
"
Please update your sympy installation!
"
)
optims_c99
=
[]
optims_c99
=
[]
optims_pystencils_cpu
=
[]
optims_pystencils_cpu
=
[]
optims_pystencils_gpu
=
[]
optims_pystencils_gpu
=
[]
...
@@ -34,7 +38,8 @@ def optimize_assignments(assignments, optimizations):
...
@@ -34,7 +38,8 @@ def optimize_assignments(assignments, optimizations):
if
HAS_REWRITING
:
if
HAS_REWRITING
:
assignments
=
[
Assignment
(
a
.
lhs
,
optimize
(
a
.
rhs
,
optimizations
))
assignments
=
[
Assignment
(
a
.
lhs
,
optimize
(
a
.
rhs
,
optimizations
))
if
hasattr
(
a
,
'
lhs
'
)
else
a
for
a
in
assignments
]
if
hasattr
(
a
,
'
lhs
'
)
and
not
a
.
rhs
.
atoms
(
IntegerFunctionTwoArgsMixIn
)
else
a
for
a
in
assignments
]
assignments_nodes
=
[
a
.
atoms
(
SympyAssignment
)
for
a
in
assignments
]
assignments_nodes
=
[
a
.
atoms
(
SympyAssignment
)
for
a
in
assignments
]
for
a
in
itertools
.
chain
.
from_iterable
(
assignments_nodes
):
for
a
in
itertools
.
chain
.
from_iterable
(
assignments_nodes
):
a
.
optimize
(
optimizations
)
a
.
optimize
(
optimizations
)
...
...
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