Changeset d36facf in sasview for park-1.2.1/park/lib


Ignore:
Timestamp:
Nov 30, 2011 10:41:07 AM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
60bca1a
Parents:
0003cc3
Message:

Re #5 fixing park compilation on MSVC (turning code into proper C)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park-1.2.1/park/lib/resolution.c

    r0003cc3 rd36facf  
    2222    int sign = 1; 
    2323 
    24     double t; 
    25     double y; 
     24    double t = 1.0; 
     25    double y = 1.0; 
    2626    if (x < 0) 
    2727        sign = -1; 
     
    179179  const double two_sigma_sq = 2. * sigma * sigma; 
    180180  double z, Glo, erflo, erfmin, R; 
     181  double zhi, Ghi, erfhi, m, b; 
    181182   
    182183  z = Qo - Qin[k]; 
     
    190191  
    191192    /* Compute the next endpoint */ 
    192     const double zhi = Qo - Qin[k]; 
    193     const double Ghi = exp(-zhi*zhi/two_sigma_sq); 
    194     const double erfhi = erf(-zhi/(SQRT2*sigma)); 
    195     const double m = (Rin[k]-Rin[k-1])/(Qin[k]-Qin[k-1]); 
    196     const double b = Rin[k] - m * Qin[k]; 
     193    zhi = Qo - Qin[k]; 
     194    Ghi = exp(-zhi*zhi/two_sigma_sq); 
     195    erfhi = erf(-zhi/(SQRT2*sigma)); 
     196    m = (Rin[k]-Rin[k-1])/(Qin[k]-Qin[k-1]); 
     197    b = Rin[k] - m * Qin[k]; 
    197198 
    198199    /* Add the integrals. */ 
     
    235236{ 
    236237  int lo,out; 
     238  double sigma, Qo, limit; 
    237239 
    238240  /* FIXME fails if Qin are not sorted; slow if Q not sorted */ 
     
    243245  for (out=0; out < N; out++) { 
    244246    /* width of resolution window for Q is w = 2 dQ^2. */ 
    245     const double sigma = dQ[out]; 
    246     const double Qo = Q[out]; 
    247     const double limit = sqrt(-2.*sigma*sigma* LOG_RESLIMIT); 
     247    sigma = dQ[out]; 
     248    Qo = Q[out]; 
     249    limit = sqrt(-2.*sigma*sigma* LOG_RESLIMIT); 
    248250 
    249251    /* if (out%20==0) printf("%d: Q,dQ = %g,%g\n",out,Qo,sigma); */ 
Note: See TracChangeset for help on using the changeset viewer.