Skip to content
Snippets Groups Projects
Commit e4766ca5 authored by Markus Holzer's avatar Markus Holzer
Browse files

Implemented sp.Indexed

parent e10f45b7
No related branches found
No related tags found
1 merge request!292Rebase of pystencils Type System
import os import os
from collections.abc import Hashable from collections.abc import Hashable
from functools import partial, wraps, lru_cache from functools import partial, wraps
from itertools import chain from itertools import chain
from functools import lru_cache as memorycache
from joblib import Memory from joblib import Memory
from appdirs import user_cache_dir from appdirs import user_cache_dir
...@@ -23,7 +25,7 @@ def _wrapper(wrapped_func, cached_func, *args, **kwargs): ...@@ -23,7 +25,7 @@ def _wrapper(wrapped_func, cached_func, *args, **kwargs):
def memorycache_if_hashable(maxsize=128, typed=False): def memorycache_if_hashable(maxsize=128, typed=False):
def wrapper(func): def wrapper(func):
return partial(_wrapper, func, lru_cache(maxsize, typed)(func)) return partial(_wrapper, func, memorycache(maxsize, typed)(func))
return wrapper return wrapper
......
...@@ -190,7 +190,8 @@ class TypeAdder: ...@@ -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) # # 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)] # # args_types = [self.figure_out_type(arg) for arg in expr.args if arg not in (-1, 1)]
elif isinstance(expr, sp.Indexed): elif isinstance(expr, sp.Indexed):
raise NotImplementedError('sp.Indexed') typed_symbol = expr.base.label
return expr, typed_symbol.dtype
elif isinstance(expr, ExprCondPair): elif isinstance(expr, ExprCondPair):
expr_expr, expr_type = self.figure_out_type(expr.expr) expr_expr, expr_type = self.figure_out_type(expr.expr)
condition, condition_type = self.figure_out_type(expr.cond) condition, condition_type = self.figure_out_type(expr.cond)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment