Daniel J. Duffy's Blog - Software
http://www.wilmott.com/blogs/cuchulainn/index.cfm
en-usSat, 30 Apr 2016 14:13:07 --0100Thu, 29 Mar 2012 11:14:00 --0100BlogCFChttp://blogs.law.harvard.edu/tech/rssblogs@wilmott.comblogs@wilmott.comWiring diagrams for software systems
http://www.wilmott.com/blogs/cuchulainn/index.cfm/2012/3/29/Wiring-diagrams-for-software-systems
This is an attempt at a wiring diagram (UML component diagram) to describe loosely-coupled systems. You customise/extend the application.
Of course, this is only one form of communication.
Feedback welcome.
SoftwareThu, 29 Mar 2012 11:14:00 --0100http://www.wilmott.com/blogs/cuchulainn/index.cfm/2012/3/29/Wiring-diagrams-for-software-systemsStatistical Distributions, boost Part III
http://www.wilmott.com/blogs/cuchulainn/index.cfm/2009/4/17/Statistical-Distributions-boost-Part-III
The Boost Math Toolkit contains a number of template classes for a wide range of univariate continuous and discrete probability distributions. We can define a probability distribution by giving its defining parameters and using them in the constructor of the corresponding template class. In general, each distribution has member functions to compute mean and standard deviation while the most extensive functionality is to be found in free (that is, non-member) functions. The library supports the following categories of functions:
. Essential functions (pdf, cdf, cdf complement)
. Measures of central tendency (mean, median, mode, quantile)
. Measures of dispersion (standard deviation, variance)
. Kurtosis, kurtosis excess, hazard functions
The library contains many of the most popular discrete and continuous probability distribution functions that we can use in computational finance. It is worth mentioning that it has now support for the Students t-distribution, Gamma distribution, Chi Squared distribution and the Noncentral Chi Squared distribution.
What are the advantages of this library in our opinion?
. Standardisation (the code has been peer-reviewed and conforms to the boost design standard)
. Quality: the code is efficient, robust and portable. As developer, you use the library without having to be concerned with its maintenance
. Building applications: you can use the classes in the library as part of large software systems
. No more pseudo-code needed: instead of discussing non-runnable code we can use code from Boost.Math directly, thus allowing readers to check the validity of the presented numerical results.
SoftwareFri, 17 Apr 2009 17:25:00 --0100http://www.wilmott.com/blogs/cuchulainn/index.cfm/2009/4/17/Statistical-Distributions-boost-Part-IIIThe boost Library Part II: Linear Algebra and Matrices
http://www.wilmott.com/blogs/cuchulainn/index.cfm/2009/3/21/The-boost-Library-Part-II-Linear-Algebra-and-Matrices
The boost.uBLAS library supports vector and matrix data structures and basic linear operations on these structures. The syntax closely reflects mathematical notation because operator overloading is used to implement these operations. Furthermore, the library uses expression templates to generate efficient code. The library has been influenced by a number of other libraries such as BLAS, Blitz++, POOMA and MTL and the main design goals are:
. Use mathematical notation whenever appropriate
. Efficiency (time and resource management)
. Functionality (provide features that appeal to a wide range of application areas)
. Compatibility (array-like indexing and use of STL allocators for storage allocation)
The two most important data structures represent vectors and matrices. A vector is a one-dimensional structure while a matrix is a two-dimensional structure. We can define various vector and (especially) matrix patterns that describe how their elements are arranged in memory; examples are dense, sparse, banded, triangular, symmetric and Hermitian. These patterned matrices are needed in many kinds of applications and the can be used directly in code without you having to create them yourself. Furthermore, we can apply primitive operations on vectors and matrices:
Addition of vectors and matrices
Scalar multiplication
Computed assignments
Transformations
Norms of vectors and matrices
Inner and outer products
We can use these operations in code and applications. Finally, we can define subvectors and submatrices as well as ranges and slices of vectors and matrices.
Vectors and matrices are fundamental to financial and scientific applications and having a well-developed library such as boost.Tuple with ready-to-use modules will free up developer time. Seeing that matrix algebra consumes much of the effort in an application we expect that the productivity gains will be appreciable in general.
The applications of this library to PDE, Monte Carlo and other problems in computational finance are immediately obvious.See
http://www.datasimfinancial.com/forum/viewtopic.php?t=111
SoftwareSat, 21 Mar 2009 07:14:00 --0100http://www.wilmott.com/blogs/cuchulainn/index.cfm/2009/3/21/The-boost-Library-Part-II-Linear-Algebra-and-MatricesThe boost library and Computational Finance, Part I: Roadmap
http://www.wilmott.com/blogs/cuchulainn/index.cfm/2009/2/22/boost
This is joint work with Dr. Bojan Nikolic. This blog is a summary of what boost 1.38 has to offer. The chances are that what you plan to do (in C++) and spend sleepness hours on has already been done by the boost developers.
Here it comes, brace yourself :)
www.boost.org
//
1. Algorithms
Foreach (avoiding boiler-plate iterators)
BGL (Graph library and graph algorithms)
//
2. Data Types and Data Structures
Any (generic heterogeneous data types)
Tuple (modeling multiple values in one class)
//
3. Data Containers
Array (compile-time one-dimensional arrays)
Bimap (bidirectional maps, many-to-many)
Dynamic bitsets (sets of dynamic bits)
Multi-Array (n-dimensional arrays)
Multi-Index (containers with one or more indices)
Property Map (key/value pairs)
Variant (discriminated union container)
Pointer Container (heap polymorphic objects)
//
4. I/O and Networking
Asio (portable networking, sockets)
Serialization (persistence and marshalling)
//
5. Utilities
Smart Ptr (five smart pointer template classes)
//
6. Mathematics and Numerics
Accumulators (statstical and time series)
Integer (type-safe integers)
Interval (operations on mathematical intervals)
Math (GCD, LCM, complex trigonometric functions)
Statistical distributions (~25 univariates)
Numeric Conversion (policy-based)
Random (a complete system for RNG)
Rational (rational number class)
uBlas (matrix/vector; basic linear algebra routines)
//
7. Higher-Order Programming
Bind (framework for function pointers and functors)
Function (function wrappers/deferred callbacks)
Functional (templates for function object wrappers)
Lambda (small unnamed functions)
Signals (the Observer pattern using signals, slots)
Spirit (LL parser defined as EBNF grammars)
//
8. String and Text Processing
Conversion (polymorphic and lexical casts)
Format (formatting according to a format-string)
Regex (regular expression library)
String Algo (string algorithms library)
Tokenizer (break a string into a series of tokens)
Xpressive (regular expressions and functionality)
//
9. Multithreading and Concurrent/Parallel Programming
Interprocess (shared memory, mutexes, memory maps)
MPI (Message Passing Interface, distributed memory)
Thread (potable C++ multi-threading)
//
10. Template and MetaTemplate Progamming
Function Types (classify, decompose and synthesize)
Fusion (library for working with tuples)
//
11. Miscellaneous
Date Time (generic date-time libraries)
Exception (transporting arbitrary data)
Flyweight (large quantities of redundant objects)
Tribool (3-state Boolean type library)
Units (dimensional analysis)
//
12. Correctness and Testing
Concept Check (tools for generic programming)
Test (simple program testing, unit testing)
SoftwareSun, 22 Feb 2009 13:34:00 --0100http://www.wilmott.com/blogs/cuchulainn/index.cfm/2009/2/22/boostProgramming Teasers in C++ and Matlab
http://www.wilmott.com/blogs/cuchulainn/index.cfm/2008/4/23/Programming-Teasers-in-C-and-Matlab
I came across a set of programming exercises from the 2007 World Intercollegiate Programming Contest. You could program these in Matlab or C++, for example but the usefulness of these questions is that they test a number of skills:
. Analysing a problem (what is the problem)
. Designing (how to solve the problem)
. Matlab/C++ (implement the problem)
So, the process is "what to do, how to do, do" in that order. This approach is also good for the thought process; each activity is independent and feeds into it successor.
At the design level, the crucial element is the design of appropriate data structures and the corresponding algorithms that operate on them.
The choice between OO and generic programming is a non-issue because they both can be used.
I would recommend using STL and boost because they have the tools that we use as the plumbing. Matlab also has many libraries as well.
Testing student knowledge using these kinds of tests is more telling than focusing exclusively on syntax.
The thread on Software and the link to the original ACM questions is:
//
http://www.wilmott.com/messageview.cfm?catid=10&threadid=60837
//
SoftwareWed, 23 Apr 2008 07:39:00 --0100http://www.wilmott.com/blogs/cuchulainn/index.cfm/2008/4/23/Programming-Teasers-in-C-and-MatlabIn the C++ Lion's Den: Learning C++ step-by-step
http://www.wilmott.com/blogs/cuchulainn/index.cfm/2007/2/10/In-the-C-Lions-Den-Learning-C-stepbystep
Learning C++, Part I
Get it working
A well-kept secret concerning the taming of the C++ lion is that you must learn the fundamentals before you start using more advanced syntax.
Here is my own personal list that I have used with (very many) students since 1991. It corresponds to green belt knowledge:
1.Basic class structure; private and public members; header and code files
2.The vital keyword ?const? and the 4 places where it is used
3.Function and operator overloading; creating your own operators
4.Memory management; STACK and HEAP
5.Basic templates; STL, list<T> container and simple iterators
I have found that once these issues are mastered (ESPECIALLY point 4) then you will have few major problems later.
C++ is a large and flexible language. By neglecting the fundamentals we run the risk of floundering when embarking on real projects. As in judo, learn how to break fall before attempting a hip throw!
SoftwareSat, 10 Feb 2007 14:48:00 --0100http://www.wilmott.com/blogs/cuchulainn/index.cfm/2007/2/10/In-the-C-Lions-Den-Learning-C-stepbystep