Changes in explore/precision.py [cd28947:fba9ca0] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/precision.py
rcd28947 rfba9ca0 207 207 return model_info 208 208 209 # Hack to allow second parameter A in the gammainc and gammaincc functions. 210 # Create a 2-D variant of the precision test if we need to handle other two 211 # parameter functions. 209 # Hack to allow second parameter A in two parameter functions 212 210 A = 1 213 211 def parse_extra_pars(): 214 """215 Parse the command line looking for the second parameter "A=..." for the216 gammainc/gammaincc functions.217 """218 212 global A 219 213 … … 339 333 ) 340 334 add_function( 341 # Note: "a" is given as A=... on the command line via parse_extra_pars342 335 name="gammainc(x)", 343 336 mp_function=lambda x, a=A: mp.gammainc(a, a=0, b=x)/mp.gamma(a), … … 346 339 ) 347 340 add_function( 348 # Note: "a" is given as A=... on the command line via parse_extra_pars349 341 name="gammaincc(x)", 350 342 mp_function=lambda x, a=A: mp.gammainc(a, a=x, b=mp.inf)/mp.gamma(a), … … 411 403 ) 412 404 add_function( 413 name=" gauss_coil",405 name="debye", 414 406 mp_function=lambda x: 2*(mp.exp(-x**2) + x**2 - 1)/x**4, 415 407 np_function=lambda x: 2*(np.expm1(-x**2) + x**2)/x**4, 416 408 ocl_function=make_ocl(""" 417 409 const double qsq = q*q; 418 // For double: use O(5) Pade with 0.5 cutoff (10 mad + 1 divide) 419 // For single: use O(7) Taylor with 0.8 cutoff (7 mad) 420 if (qsq < 0.0) { 410 if (qsq < 1.0) { // Pade approximation 421 411 const double x = qsq; 422 412 if (0) { // 0.36 single … … 428 418 const double B1=3./8., B2=3./56., B3=1./336.; 429 419 return (((A3*x + A2)*x + A1)*x + 1.)/(((B3*x + B2)*x + B1)*x + 1.); 430 } else if ( 0) { // 1.0 for single, 0.25 for double420 } else if (1) { // 1.0 for single, 0.25 for double 431 421 // PadeApproximant[2*Exp[-x^2] + x^2-1)/x^4, {x, 0, 8}] 432 422 const double A1=1./15., A2=1./60, A3=0., A4=1./75600.; … … 441 431 /(((((B5*x + B4)*x + B3)*x + B2)*x + B1)*x + 1.); 442 432 } 443 } else if (qsq < 0.8) {433 } else if (qsq < 1.) { // Taylor series; 0.9 for single, 0.25 for double 444 434 const double x = qsq; 445 435 const double C0 = +1.;
Note: See TracChangeset
for help on using the changeset viewer.