Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frederik Hennig
pystencils
Commits
e4766ca5
Commit
e4766ca5
authored
May 03, 2022
by
Markus Holzer
Browse files
Implemented sp.Indexed
parent
e10f45b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
pystencils/cache.py
View file @
e4766ca5
import
os
from
collections.abc
import
Hashable
from
functools
import
partial
,
wraps
,
lru_cache
from
functools
import
partial
,
wraps
from
itertools
import
chain
from
functools
import
lru_cache
as
memorycache
from
joblib
import
Memory
from
appdirs
import
user_cache_dir
...
...
@@ -23,7 +25,7 @@ def _wrapper(wrapped_func, cached_func, *args, **kwargs):
def
memorycache_if_hashable
(
maxsize
=
128
,
typed
=
False
):
def
wrapper
(
func
):
return
partial
(
_wrapper
,
func
,
lru_
cache
(
maxsize
,
typed
)(
func
))
return
partial
(
_wrapper
,
func
,
memory
cache
(
maxsize
,
typed
)(
func
))
return
wrapper
...
...
pystencils/typing/leaf_typing.py
View file @
e4766ca5
...
...
@@ -190,7 +190,8 @@ class TypeAdder:
# # TODO can we ignore this and move it to general expr handling, i.e. removing Mul? (See todo in backend)
# # args_types = [self.figure_out_type(arg) for arg in expr.args if arg not in (-1, 1)]
elif
isinstance
(
expr
,
sp
.
Indexed
):
raise
NotImplementedError
(
'sp.Indexed'
)
typed_symbol
=
expr
.
base
.
label
return
expr
,
typed_symbol
.
dtype
elif
isinstance
(
expr
,
ExprCondPair
):
expr_expr
,
expr_type
=
self
.
figure_out_type
(
expr
.
expr
)
condition
,
condition_type
=
self
.
figure_out_type
(
expr
.
cond
)
...
...
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