예제 #1
0
 def map_call(self, expr):
     if isinstance(expr.function, prim.Variable) \
             and expr.function.name == "bessel_j":
         order, arg = expr.parameters
         self.rec(arg)
         assert isinstance(order, int)
         self.bessel_j_arg_to_top_order[arg] = max(
             self.bessel_j_arg_to_top_order.get(arg, 0), abs(order))
     else:
         return WalkMapper.map_call(self, expr)
예제 #2
0
def test_mappers():
    from pymbolic import variables
    f, x, y, z = variables("f x y z")

    for expr in [f(x, (y, z), name=z**2)]:
        from pymbolic.mapper import WalkMapper
        from pymbolic.mapper.dependency import DependencyMapper
        str(expr)
        IdentityMapper()(expr)
        WalkMapper()(expr)
        DependencyMapper()(expr)
예제 #3
0
 def map_call(self, expr):
     if isinstance(expr.function, prim.Variable) \
             and expr.function.name == "bessel_j":
         order, arg = expr.parameters
         self.rec(arg)
         assert isinstance(order, int)
         self.bessel_j_arg_to_top_order[arg] = max(
                 self.bessel_j_arg_to_top_order.get(arg, 0),
                 abs(order))
     else:
         return WalkMapper.map_call(self, expr)