Changeset 1d78e4b in sasview for sansmodels/src/sans/models/c_models/parameters.cpp
- Timestamp:
- Jan 19, 2011 6:00:50 PM (14 years ago)
- 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:
- a0da535
- Parents:
- 12c5b87
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/parameters.cpp
r0fff338f r1d78e4b 63 63 } else { 64 64 for(int i=0; i<npts; i++) { 65 double val = value + width * (1.0* i/float(npts-1) - 0.5);65 double val = value + width * (1.0*double(i)/double(npts-1) - 0.5); 66 66 67 67 if ( ((*par).has_min==false || val>(*par).min) … … 85 85 npts = 21; 86 86 width = 0.0; 87 nsigmas = 3 ;87 nsigmas = 3.0; 88 88 }; 89 89 … … 115 115 width = 0.0; 116 116 npts = 1; 117 nsigmas = 3 ;117 nsigmas = 3.0; 118 118 } 119 119 … … 126 126 for(int i=0; i<npts; i++) { 127 127 // We cover n(nsigmas) times sigmas on each side of the mean 128 double val = value + width * (2.0*nsigmas*i/float(npts-1) - nsigmas); 129 128 double val = value + width * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 130 129 if ( ((*par).has_min==false || val>(*par).min) 131 130 && ((*par).has_max==false || val<(*par).max) ) { … … 145 144 npts = 21; 146 145 width = 0.0; 147 nsigmas = 3 ;146 nsigmas = 3.0; 148 147 }; 149 148 … … 157 156 double lognormal_weight(double mean, double sigma, double x) { 158 157 159 double sigma2 = pow(sigma, 2 );160 return 1 /(x*sigma2) * exp( -pow((log(x) -mean), 2) / (2*sigma2));158 double sigma2 = pow(sigma, 2.0); 159 return 1.0/(x*sigma2) * exp( -pow((log(x) -mean), 2.0) / (2.0*sigma2)); 161 160 162 161 } … … 174 173 width = 0.0; 175 174 npts = 1; 176 nsigmas = 3 ;175 nsigmas = 3.0; 177 176 } 178 177 … … 185 184 for(int i=0; i<npts; i++) { 186 185 // We cover n(nsigmas) times sigmas on each side of the mean 187 double val = value + width * (2.0*nsigmas* i/float(npts-1) - nsigmas);186 double val = value + width * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 188 187 189 188 if ( ((*par).has_min==false || val>(*par).min) … … 205 204 npts = 21; 206 205 width = 0.0; 207 nsigmas = 3 ;206 nsigmas = 3.0; 208 207 }; 209 208 … … 217 216 double schulz_weight(double mean, double sigma, double x) { 218 217 double vary, expo_value; 219 double z = pow(mean/ sigma, 2 )-1;218 double z = pow(mean/ sigma, 2.0)-1.0; 220 219 double R= x/mean; 221 double zz= z+1 ;220 double zz= z+1.0; 222 221 double expo; 223 222 expo = zz*log(zz)+z*log(R)-R*zz-log(mean)-lgamma(zz); … … 237 236 width = 0.0; 238 237 npts = 1; 239 nsigmas = 3 ;238 nsigmas = 3.0; 240 239 } 241 240 … … 248 247 for(int i=0; i<npts; i++) { 249 248 // We cover n(nsigmas) times sigmas on each side of the mean 250 double val = value + width * (2.0*nsigmas* i/float(npts-1) - nsigmas);249 double val = value + width * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 251 250 252 251 if ( ((*par).has_min==false || val>(*par).min)
Note: See TracChangeset
for help on using the changeset viewer.