- Timestamp:
- Sep 10, 2018 4:16:46 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- d299327
- Parents:
- 3f818b2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/precision.py
r2a7e20e ree60aa7 357 357 ) 358 358 add_function( 359 name=" debye",359 name="gauss_coil", 360 360 mp_function=lambda x: 2*(mp.exp(-x**2) + x**2 - 1)/x**4, 361 361 np_function=lambda x: 2*(np.expm1(-x**2) + x**2)/x**4, 362 362 ocl_function=make_ocl(""" 363 363 const double qsq = q*q; 364 if (qsq < 1.0) { // Pade approximation 364 // For double: use O(5) Pade with 0.5 cutoff (10 mad + 1 divide) 365 // For single: use O(7) Taylor with 0.8 cutoff (7 mad) 366 if (qsq < 0.0) { 365 367 const double x = qsq; 366 368 if (0) { // 0.36 single … … 372 374 const double B1=3./8., B2=3./56., B3=1./336.; 373 375 return (((A3*x + A2)*x + A1)*x + 1.)/(((B3*x + B2)*x + B1)*x + 1.); 374 } else if ( 1) { // 1.0 for single, 0.25 for double376 } else if (0) { // 1.0 for single, 0.25 for double 375 377 // PadeApproximant[2*Exp[-x^2] + x^2-1)/x^4, {x, 0, 8}] 376 378 const double A1=1./15., A2=1./60, A3=0., A4=1./75600.; … … 385 387 /(((((B5*x + B4)*x + B3)*x + B2)*x + B1)*x + 1.); 386 388 } 387 } else if (qsq < 1.) { // Taylor series; 0.9 for single, 0.25 for double389 } else if (qsq < 0.8) { 388 390 const double x = qsq; 389 391 const double C0 = +1.;
Note: See TracChangeset
for help on using the changeset viewer.