def generate(self):
        so_far = super().generate()
        in_name = self.gensym("in")
        out_abs = so_far[0].in_names[0]
        sign = self.gensym("sign")
        abs = lego_blocks.Abs(numeric_types.fp64(), [in_name], [out_abs, sign])

        in_negflip = so_far[-1].out_names[0]
        out_name = self.gensym("out")
        neg = lego_blocks.NegFlip(numeric_types.fp64(), [in_negflip, sign],
                                  [out_name])

        return [abs] + so_far + [neg]
    def generate(self):
        so_far = super().generate()
        in_name = self.gensym("in")
        out_abs = so_far[0].in_names[0]
        sign = self.gensym("sign")
        abs = lego_blocks.Abs(numeric_types.fp64(), [in_name], [out_abs, sign])

        return [abs] + so_far
Exemple #3
0
    def generate(self):
        our_in_type = self.in_node.out_type
        so_far = super().generate()
        in_name = self.gensym("in")
        out_red = self.gensym("out")
        k = self.gensym("k")
        add = lego_blocks.SimpleAdditive(numeric_types.fp64(), [in_name],
                                         [out_red, k], our_in_type.domain.sup)

        in_case = out_red
        out_case = so_far[0].in_names[0]
        cases = {
            0: in_case,
            1: "{}-{}".format(our_in_type.domain.sup, in_case),
        }
        case = lego_blocks.Case(numeric_types.fp64(), [in_case, k], [out_case],
                                2, cases)

        return [add, case] + so_far
Exemple #4
0
    def generate(self):
        our_in_type = self.in_node.out_type
        so_far = super().generate()
        in_name = self.gensym("in")
        out_red = so_far[0].in_names[0]
        k = self.gensym("k")
        add = lego_blocks.SimpleAdditive(numeric_types.fp64(), [in_name],
                                         [out_red, k], our_in_type.domain.sup)

        return [add] + so_far
Exemple #5
0
 def generate(self):
     p = super().generate()
     in_name = self.gensym("in")
     out_name = self.gensym("out")
     return [forms.General(numeric_types.fp64(), [in_name], [out_name], p)]
Exemple #6
0
 def generate(self):
     res = sollya.Result(self.function + "(x)", self.domain, self.monomials,
                         numeric_types.fp64())
     return forms.Polynomial(self.function, self.monomials,
                             res.coefficients, self.domain)