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
pycodegen
pystencils
Commits
b7a64234
Commit
b7a64234
authored
11 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
Symboloc C-style integer remainder
parent
48bcd760
No related branches found
No related tags found
1 merge request
!394
Extend symbolic language support
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pystencils/backend/kernelcreation/freeze.py
+3
-0
3 additions, 0 deletions
src/pystencils/backend/kernelcreation/freeze.py
src/pystencils/sympyextensions/integer_functions.py
+10
-1
10 additions, 1 deletion
src/pystencils/sympyextensions/integer_functions.py
with
13 additions
and
1 deletion
src/pystencils/backend/kernelcreation/freeze.py
+
3
−
0
View file @
b7a64234
...
...
@@ -33,6 +33,7 @@ from ..ast.expressions import (
PsCast
,
PsConstantExpr
,
PsIntDiv
,
PsRem
,
PsLeftShift
,
PsLookup
,
PsRightShift
,
...
...
@@ -391,6 +392,8 @@ class FreezeExpressions:
return
PsCall
(
PsMathFunction
(
MathFunctions
.
ATan2
),
args
)
case
integer_functions
.
int_div
():
return
PsIntDiv
(
*
args
)
case
integer_functions
.
int_rem
():
return
PsRem
(
*
args
)
case
integer_functions
.
bit_shift_left
():
return
PsLeftShift
(
*
args
)
case
integer_functions
.
bit_shift_right
():
...
...
This diff is collapsed.
Click to expand it.
src/pystencils/sympyextensions/integer_functions.py
+
10
−
1
View file @
b7a64234
...
...
@@ -45,9 +45,18 @@ class bitwise_or(IntegerFunctionTwoArgsMixIn):
# noinspection PyPep8Naming
class
int_div
(
IntegerFunctionTwoArgsMixIn
):
"""
C-style integer division,
"""
def
_eval_op
(
self
,
arg1
,
arg2
):
return
int
(
arg1
//
arg2
)
return
int
(
arg1
/
arg2
)
class
int_rem
(
IntegerFunctionTwoArgsMixIn
):
"""
C-style integer remainder
"""
def
_eval_op
(
self
,
arg1
,
arg2
):
div
=
int
(
arg1
/
arg2
)
return
arg1
-
div
*
arg2
# noinspection PyPep8Naming
...
...
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