Ejemplo n.º 1
0
    def apply(self, inputs):
        # This assumes `inputs` are already broadcast
        array = head(inputs)
        extent = array.dims.extent

        for i in range(extent):
            eval(self.subterm, index(inputs, i))

        return head(inputs)
Ejemplo n.º 2
0
    def apply(self, inputs):
        # This assumes `inputs` are already broadcast
        array = head(inputs)
        extent = array.dims.extent

        for i in range(extent):
            eval(self.subterm, index(inputs, i))

        return head(inputs)
Ejemplo n.º 3
0
    def apply(self, inputs):
        # This assumes `inputs` are already broadcast
        out = head(inputs)
        extent = out.dims.extent
        inputs = tail(inputs)

        for i in range(extent):
            out[i] = eval(self.subterm, index(inputs, i))

        return out
Ejemplo n.º 4
0
    def apply(self, inputs):
        # This assumes `inputs` are already broadcast
        out = head(inputs)
        extent = out.dims.extent
        inputs = tail(inputs)

        for i in range(extent):
            out[i] = eval(self.subterm, index(inputs, i))

        return out
Ejemplo n.º 5
0
def ckernel_element_wrapper(p):
    data = p[0]
    out = head(data.inputs)
    inputs = tail(data.inputs)
    out[0] = eval(data.term, inputs)
Ejemplo n.º 6
0
def index(inputs, i):
    hd = head(inputs)
    tl = tail(inputs)
    return StaticTuple(hd[i], index(tl, i))
Ejemplo n.º 7
0
def lookup(args, n):
    return head(args)
Ejemplo n.º 8
0
def eval_subterms(subterms, inputs):
    """Evaluate the given `subterms` (code) with the given `inputs` (data)"""
    hd = eval(head(subterms), inputs)
    tl = eval_subterms(tail(subterms), inputs)
    return StaticTuple(hd, tl)
Ejemplo n.º 9
0
def ckernel_element_wrapper(p):
    data = p[0]
    out = head(data.inputs)
    inputs = tail(data.inputs)
    out[0] = eval(data.term, inputs)
Ejemplo n.º 10
0
def index(inputs, i):
    hd = head(inputs)
    tl = tail(inputs)
    return StaticTuple(hd[i], index(tl, i))
Ejemplo n.º 11
0
def lookup(args, n):
    return head(args)
Ejemplo n.º 12
0
def eval_subterms(subterms, inputs):
    """Evaluate the given `subterms` (code) with the given `inputs` (data)"""
    hd = eval(head(subterms), inputs)
    tl = eval_subterms(tail(subterms), inputs)
    return StaticTuple(hd, tl)