Changeset ee60aa7 in sasmodels for explore/precision.py


Ignore:
Timestamp:
Sep 10, 2018 2:16:46 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

clean up effective radius functions; improve mono_gauss_coil accuracy; start moving VR into C

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/precision.py

    r2a7e20e ree60aa7  
    357357) 
    358358add_function( 
    359     name="debye", 
     359    name="gauss_coil", 
    360360    mp_function=lambda x: 2*(mp.exp(-x**2) + x**2 - 1)/x**4, 
    361361    np_function=lambda x: 2*(np.expm1(-x**2) + x**2)/x**4, 
    362362    ocl_function=make_ocl(""" 
    363363    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) { 
    365367        const double x = qsq; 
    366368        if (0) { // 0.36 single 
     
    372374            const double B1=3./8., B2=3./56., B3=1./336.; 
    373375            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 double 
     376        } else if (0) { // 1.0 for single, 0.25 for double 
    375377            // PadeApproximant[2*Exp[-x^2] + x^2-1)/x^4, {x, 0, 8}] 
    376378            const double A1=1./15., A2=1./60, A3=0., A4=1./75600.; 
     
    385387                  /(((((B5*x + B4)*x + B3)*x + B2)*x + B1)*x + 1.); 
    386388        } 
    387     } else if (qsq < 1.) { // Taylor series; 0.9 for single, 0.25 for double 
     389    } else if (qsq < 0.8) { 
    388390        const double x = qsq; 
    389391        const double C0 = +1.; 
Note: See TracChangeset for help on using the changeset viewer.