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
50f27d79
Commit
50f27d79
authored
6 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Add pystencils.data_types.address_of
parent
0690f5ad
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
Address of SymPy-Function `address_of`
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/data_types.py
+27
-0
27 additions, 0 deletions
pystencils/data_types.py
with
27 additions
and
0 deletions
pystencils/data_types.py
+
27
−
0
View file @
50f27d79
...
@@ -14,6 +14,33 @@ from pystencils.utils import all_equal
...
@@ -14,6 +14,33 @@ from pystencils.utils import all_equal
from
sympy.logic.boolalg
import
Boolean
from
sympy.logic.boolalg
import
Boolean
# noinspection PyPep8Naming
class
address_of
(
sp
.
Function
):
is_Atom
=
True
def
__new__
(
cls
,
arg
):
obj
=
sp
.
Function
.
__new__
(
cls
,
arg
)
return
obj
@property
def
canonical
(
self
):
if
hasattr
(
self
.
args
[
0
],
'
canonical
'
):
return
self
.
args
[
0
].
canonical
else
:
raise
NotImplementedError
()
@property
def
is_commutative
(
self
):
return
self
.
args
[
0
].
is_commutative
@property
def
dtype
(
self
):
if
hasattr
(
self
.
args
[
0
],
'
dtype
'
):
return
PointerType
(
self
.
args
[
0
].
dtype
,
restrict
=
True
)
else
:
return
PointerType
(
'
void
'
,
restrict
=
True
)
# noinspection PyPep8Naming
# noinspection PyPep8Naming
class
cast_func
(
sp
.
Function
):
class
cast_func
(
sp
.
Function
):
is_Atom
=
True
is_Atom
=
True
...
...
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