Ask Your Question

GrantE's profile - activity

2016-07-18 07:07:26 +0200 commented answer fast_callable with lists

Thanks for your comment!
It appears that the problem isn't actually with using a List with fast_callable but when I try to use the List index as a variable. I was able to do a workaround by defining a new function by summing all of the terms which refer to this List in the function using a simple loop. I am then able to use fast_callable with this new function. The speedup is almost 10-fold !

2016-07-15 07:24:48 +0200 commented question fast_callable with lists

Hi, thanks for your comment - I should've included a working snippet example of what I am trying to do.

  1. This snippet works: k0a=1.8; func(m)=bessel_J(m^2,k0a); fmax=fast_callable(func, vars=[m]); print func(1.); print fmax(1.);

0.581516951731165; 0.581516951731165

  1. This snippet doesn't work: k0a=1.8; vn=[0.0, 1.0, 4.0, 9.0]; func(m)=bessel_J(vn[m],k0a); fmax=fast_callable(func, vars=[m]);

Traceback (click to the left of this block for traceback) ... TypeError: unable to convert m to an integer

2016-07-14 12:18:47 +0200 asked a question fast_callable with lists

I tried using the fast_callable function with a List and keep getting the "Unable to convert...to an integer" error. I am using the list to simply pass parameters to the function.

Are there any special rules or techniques for passing Lists or Arrays to fast-callable ?

Thanks.

2016-07-14 12:18:47 +0200 asked a question fast_callable lists

I tried using the fast_callable function with a List and keep getting the "Unable to convert...to an integer" error. I am using the list to simply pass parameters to the function.

Are there any special rules or techniques for passing Lists or Arrays to fast-callable ?

Thanks.