This page did provide source code for the uncertainty-propagation classes that were described at the 49th annual Radiobioassay and Radiochemical Measurements Conference in Jackson Hole, WY (http://www.rrmc-baer.org). That code was old and had not been improved for several years, but since 2003 it has been largely rewritten, simplified, and brought into better conformance with the C++ standard. The original code predated the C++ standard. Keith left it here for over three years, knowing that it wasn’t pretty, but in early 2007 he replaced it with a new version. The old version worked and demonstrated the concepts, but it also showed clearly that the programmer had much to learn about C++. The latter observation may still be true, but at least he has made significant progress.
The latest revisions were begun in late March 2007 and completed in March 2008, but with no work done between April and February. So many distractions.
If you encounter any problems using these files, please contact Keith at Work@mccroan.com. Send constructive criticism to the same address.
There are actually three implementations here. The first uses a smart pointer type defined in the header file upf.hpp. Except for the smart-pointer template, this version is probably the simplest. The second implementation uses the Boost library, and boost::shared_ptr in particular. The third (and most recent) implementation also uses shared_ptr, but it makes more use of the PIMPL idiom to hide implementation details from the application, and, more importantly, it makes greater use of shared_ptr to reduce the cost of copying large containers, especially when returning them from functions. Since shared_ptr appears likely to become part of the STL eventually, it seems reasonable to take advantage of it now, but if you prefer not to use the Boost library, the first implementation is self-contained.
Eventually two of the implementations will disappear and one will remain.
Use whatever you like, and improve it to suit you. If you strongly like it or dislike it, or if you just see ways to make it better, please give feedback to Keith. The goal is to provide a useful tool to labs or anyone else who needs to propagate uncertainty but gets bogged down in the math.
The current versions provide new features for output formatting, including ostream manipulators to control format options such as:
It is even internationalized (slightly) inasmuch as it allows a choice of decimal point character (uses locale’s decimal point by default).
Note: Trying to write the code so that it works correctly with four different compilers has been a small challenge. Each system presents its own problems, some of which can be surprising.
| Compressed Folder (Click to download) |
Description |
| upf1.zip | First implementation, not using Boost |
| upf2.zip | Second implementation, using boost::shared_ptr |
| upf3.zip | Third implementation, with more sharing (for speed) and more information hiding |
Minimal documentation (Microsoft Word): upfdoc.doc
| top | 28 Mar 2008 Keith |