Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-qxsvm Total loading time: 0 Render date: 2024-09-22T13:18:26.420Z Has data issue: false hasContentIssue false

Appendix: The OLAMI–FEDER–CHRISTENSEN Model in C

Published online by Cambridge University Press:  05 September 2012

Gunnar Pruessner
Affiliation:
Imperial College of Science, Technology and Medicine, London
Get access

Summary

Most computational physicists try to strike a balance between a number of conflicting objectives. Ideally, a model is quickly implemented, easy to maintain, readily extensible, fast and demands very little memory. A few general rules can help to get closer to that ideal. Well written code that uses proper indentation, comments and symmetries (see for example PUSH and POP below), helps to avoid bugs and improves maintainability. Howmuch tweaking and tuning can be done without spoiling readability and maintainability of the code is a matter of taste and experience. Sometimes an obfuscated implementation of an obscure algorithm makes all the difference. Yet, many optimisations have apparent limits where any reduction of interdependence and any improvement of data capture is compensated by an equal increase in computational complexity and thus runtime. Often a radical rethink is necessary to overcome such an ostensible limit of maximum information per CPU time, as examplified by the Swendsen-Wang algorithm (Swendsen and Wang, 1987) for the Ising Model, which represents a paradigmatic change from the classic Metropolis algorithm (Metropolis, Rosenbluth, Rosenbluth, et al., 1953).

Nevertheless, one should not underestimate the amount of real time as well as CPU time that can be saved by opting for a slightly less powerful code in favour of one that is more stable and correct from the start. On the same account, it usually pays to follow up even a little hunch that something is not working correctly.

Type
Chapter
Information
Self-Organised Criticality
Theory, Models and Characterisation
, pp. 357 - 390
Publisher: Cambridge University Press
Print publication year: 2012

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×