[SciPy-user] jn & lpmn or sph_jn...

Robert Kern robert.kern at gmail.com
Wed Aug 2 16:50:58 CDT 2006


fred wrote:
> Robert Kern a écrit :
> 
>> It is a ufunc, so it is created by calling PyUFunc_FromFuncAndData in 
>> Lib/special/_cephesmodule.c . 
> Hmm, it's a little too obscure for me :-(
> 
> Does it mean that the solution proposed by David is the only one ?
> I don't like it because you have to pass the dimension of x as arg and
> because of the loop (thanks anyway, David, you showed me an interesting
> way ;-)

It's probably the easiest one. There is a reason that the current forms of the 
spherical harmonic functions are not ufuncs like jn is: they can't be shoved 
into the ufunc framework since they return arrays for scalar inputs.

Note that in the f2py interface that David wrote, you won't have to pass in the 
dimension of x as an argument from Python; you just have to write the underlying 
FORTRAN subroutine to do so. The f2py interface takes care of inferring the 
dimensions of your inputs for you.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


More information about the SciPy-user mailing list