Using a Function as Input in Numba

1 view
Skip to first unread message

Nuno Calaim

unread,
Apr 28, 2015, 2:24:26 PM4/28/15
to numba...@continuum.io
Hi!

I am new to Numba but I have a question that I posted on stackoverflow.
It is here:
http://stackoverflow.com/questions/29925662/numbas-jit-fails-to-compile-function-that-has-another-function-as-input

If some of you could help me with the solution it would be great

Thank you so much

Nuno

Siu Kwan Lam

unread,
Apr 28, 2015, 2:34:12 PM4/28/15
to numba...@continuum.io
To your first question,  numba does not support function as argument, yet.  You can workaround it by making a "function factory", like:

def factory(bar)
    @jit
    def foo(a, b):
        return bar(a, b)
    return foo

@jit
def mybar(a, b):
   return a + b

myfoo = factory(mybar) 



--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAM6CXJnc8Ot_ZsYND_AOvXMGZtW1%2B305YP8OFXZ1U8Ckh-RgUA%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Reply all
Reply to author
Forward
0 new messages