Skip to content
Snippets Groups Projects

WIP: Astnodes for interpolation

1 file
+ 11
7
Compare changes
  • Side-by-side
  • Inline
@@ -3,13 +3,13 @@ import sympy as sp
@@ -3,13 +3,13 @@ import sympy as sp
from pystencils.data_types import collate_types, get_type_of_expression
from pystencils.data_types import collate_types, get_type_of_expression
from pystencils.sympyextensions import is_integer_sequence
from pystencils.sympyextensions import is_integer_sequence
bitwise_xor = sp.Function("bitwise_xor")
bitwise_xor = sp.Function("bitwise_xor", integer=True)
bit_shift_right = sp.Function("bit_shift_right")
bit_shift_right = sp.Function("bit_shift_right", integer=True)
bit_shift_left = sp.Function("bit_shift_left")
bit_shift_left = sp.Function("bit_shift_left", integer=True)
bitwise_and = sp.Function("bitwise_and")
bitwise_and = sp.Function("bitwise_and", integer=True)
bitwise_or = sp.Function("bitwise_or")
bitwise_or = sp.Function("bitwise_or", integer=True)
int_div = sp.Function("int_div")
int_div = sp.Function("int_div", integer=True)
int_power_of_2 = sp.Function("int_power_of_2")
int_power_of_2 = sp.Function("int_power_of_2", integer=True)
# noinspection PyPep8Naming
# noinspection PyPep8Naming
@@ -29,6 +29,7 @@ class modulo_floor(sp.Function):
@@ -29,6 +29,7 @@ class modulo_floor(sp.Function):
'(int64_t)((a) / (b)) * (b)'
'(int64_t)((a) / (b)) * (b)'
"""
"""
nargs = 2
nargs = 2
 
integer = True
def __new__(cls, integer, divisor):
def __new__(cls, integer, divisor):
if is_integer_sequence((integer, divisor)):
if is_integer_sequence((integer, divisor)):
@@ -60,6 +61,7 @@ class modulo_ceil(sp.Function):
@@ -60,6 +61,7 @@ class modulo_ceil(sp.Function):
'((a) % (b) == 0 ? a : ((int64_t)((a) / (b))+1) * (b))'
'((a) % (b) == 0 ? a : ((int64_t)((a) / (b))+1) * (b))'
"""
"""
nargs = 2
nargs = 2
 
integer = True
def __new__(cls, integer, divisor):
def __new__(cls, integer, divisor):
if is_integer_sequence((integer, divisor)):
if is_integer_sequence((integer, divisor)):
@@ -89,6 +91,7 @@ class div_ceil(sp.Function):
@@ -89,6 +91,7 @@ class div_ceil(sp.Function):
'( (a) % (b) == 0 ? (int64_t)(a) / (int64_t)(b) : ( (int64_t)(a) / (int64_t)(b) ) +1 )'
'( (a) % (b) == 0 ? (int64_t)(a) / (int64_t)(b) : ( (int64_t)(a) / (int64_t)(b) ) +1 )'
"""
"""
nargs = 2
nargs = 2
 
integer = True
def __new__(cls, integer, divisor):
def __new__(cls, integer, divisor):
if is_integer_sequence((integer, divisor)):
if is_integer_sequence((integer, divisor)):
@@ -118,6 +121,7 @@ class div_floor(sp.Function):
@@ -118,6 +121,7 @@ class div_floor(sp.Function):
'((int64_t)(a) / (int64_t)(b))'
'((int64_t)(a) / (int64_t)(b))'
"""
"""
nargs = 2
nargs = 2
 
integer = True
def __new__(cls, integer, divisor):
def __new__(cls, integer, divisor):
if is_integer_sequence((integer, divisor)):
if is_integer_sequence((integer, divisor)):
Loading