SasView / sasmodels

Package for calculation of small angle scattering models using OpenCL.
BSD 3-Clause "New" or "Revised" License
15 stars 27 forks source link

fast superball #485

Open pkienzle opened 2 years ago

pkienzle commented 2 years ago

The superball 1-D scattering curve is computed with four nested loops, not including loops over polydispersity dimensions and q values. Even with a limited size gaussian quadrature (n=20, qmax=0.65), the calculation is slow, and fits may be impractical.

Instead of using the full grid across all four dimensions, we may be able to get more accuracy with fewer calculations using a sparse grid. In particular, we should be able to get the equivalent of a 65 point quadrature rule across four dimensions using only 2929 evaluation points using Smolyak Quadrature. These points can be pre-calculated and included directly in the computational kernel. Code for generating grids is in the chaospy package using the function sparse_grid. I haven't tried it yet, but it looks like it can incorporate the sin θ weighting directly in the grid definition.