Changeset 1ec7efa in sasmodels for sasmodels/models/triaxial_ellipsoid.c


Ignore:
Timestamp:
Nov 25, 2015 2:44:45 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
d138d43
Parents:
a5899c8
Message:

use taylor expansion in triaxial ellipsoid model so single precision is more accurate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/triaxial_ellipsoid.c

    r994d77f r1ec7efa  
    3737            const double t = q*sqrt(acosx2 + bsinx2*(1.0-y*y) + c2*y*y); 
    3838            SINCOS(t, st, ct); 
    39             const double fq = ( t==0.0 ? 1.0 : 3.0*(st-t*ct)/(t*t*t) ); 
     39            //const double fq = ( t==0.0 ? 1.0 : 3.0*(st-t*ct)/(t*t*t) ); 
     40            const double tsq = t*t; 
     41            const double fq = (t < 1e-1) 
     42                ? 1.0 + tsq*(-3./30. + tsq*(3./840. + tsq*(-3./45360.)))// + tsq*(3./3991680.)))) 
     43                : 3.0*(st/t - ct)/tsq; 
    4044            inner += Gauss76Wt[j] * fq * fq ; 
    4145        } 
Note: See TracChangeset for help on using the changeset viewer.