Changeset 9844c3a in sasmodels for doc/guide/plugin.rst
- Timestamp:
- Sep 27, 2017 12:44:40 PM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c0d7ab3
- Parents:
- 0f48f1e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/guide/plugin.rst
r30b60d2 r9844c3a 366 366 dispersion. 367 367 368 369 Integer Parameters 370 .................. 371 372 Some models will have integer parameters, such as number of pearls in the 373 pearl necklace model, or number of shells in the multi-layer vesicle model. 374 The optimizers in BUMPS treat all parameters as floating point numbers which 375 can take arbitrary values, even for integer parameters, so your model should 376 round the incoming parameter value to the nearest integer inside your model 377 you should round to the nearest integer. In C code, you can do this using:: 378 379 static double 380 Iq(double q, ..., double fp_n, ...) 381 { 382 int n = (int)(fp_n + 0.5); 383 ... 384 } 385 386 in python:: 387 388 def Iq(q, ..., n, ...): 389 n = int(n+0.5) 390 ... 391 392 Derivatibve based optimizers such as Levenberg-Marquardt will not work 393 for integer parameters since the partial derivative is always zero, but 394 the remaining optimizers (DREAM, differential evolution, Nelder-Mead simplex) 395 will still function. 368 396 369 397 Model Computation
Note: See TracChangeset
for help on using the changeset viewer.