id summary reporter owner description type status priority milestone component resolution keywords cc workpackage 783 Performance tuning for 1D calculations pkienzle "Many of the 1D calculations involve nested integrals over a fixed set of theta and phi values, with trig functions to turn these values into something useful for the kernel. For example, the cylinder kernel, 2 trig operations, a multiply and an add can be replaced by two table lookups by converting: {{{ const double zm = M_PI_4; const double zb = M_PI_4; double total = 0.0; for (int i=0; i<76 ;i++) { const double alpha = Gauss76Z[i]*zm + zb; double sn, cn; // slots to hold sincos function output // alpha(theta,phi) the projection of the cylinder on the detector plane SINCOS(alpha, sn, cn); total += Gauss76Wt[i] * square(fq(q, sn, cn, radius, length)) * sn; } return total*zm; }}} into: {{{ double total = 0.0; for (int i=0; i<76 ;i++) { total += Gauss76Wt_times_sin_alpha[i] * square(fq(q, sin_alpha[i], cos_alpha[i], radius, length)); } return total*M_PI_4; }}} To see if this might be worthwhile, I substituted Gauss76Z for the sin and Gauss76Wt for cos, and observed a 64% speedup. It had the wrong answer of course, but it does show that this approach could be worthwhile. " enhancement new minor sasmodels WishList sasmodels SasView Bug Fixing