moble / spherical_functions

Python/numba package for evaluating Wigner D matrices and spin-weighted spherical harmonics
MIT License
52 stars 11 forks source link

When numba is fixed... #1

Closed moble closed 3 years ago

moble commented 10 years ago

The biggest problem in the design of this code is the lack of numba support (at the moment) for user-defined types or closures. In particular, I'd like WignerD to be either

  1. An object that can store information like

    complex Ra, Rb;
    double absRa, absRb, absRRatioSquared;
    int intlog10absRa, intlog10absRb;
  2. A function that can return functions that use values calculated in the original function (this is called a closure). The effect would be the same as above, where those values would be calculated once, but then the function would just use them. This feels slightly preferable to the above, except that I think it would actually be slower, because presumably the inner function would have to be re-jitted each time, which isn't fast.
moble commented 3 years ago

While numba can do this now, I won't be implementing it here. See also the spherical package code that uses this technique.