Attached is a short patch that should make it clearer how to use the Brownian bridge class. Best, Bojan === modified file 'ql/methods/montecarlo/brownianbridge.hpp' --- ql/methods/montecarlo/brownianbridge.hpp 2007-10-26 13:58:31 +0000 +++ ql/methods/montecarlo/brownianbridge.hpp 2009-02-24 19:25:56 +0000 @@ -3,6 +3,7 @@ /* Copyright (C) 2003 Ferdinando Ametrano Copyright (C) 2006 StatPro Italia srl + Copyright (C) 2009 Bojan Nikolic <[hidden email]> This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -53,21 +54,54 @@ class BrownianBridge { public: //! unit-time path + /*! The constructor generates the time grid so that each step + is of unit-time length. + + \param steps The number of steps in the path + */ BrownianBridge(Size steps); //! generic times - /*! \note the starting time of the path is assumed to be 0 - and must not be included + /*! The step times are copied from the supplied vector + + \param times Vector containing the times at which the + steps occur. This also defines the number of steps that + can be generated. + + \note the starting time of the path is assumed to be 0 and + must not be included */ BrownianBridge(const std::vector<Time>& times); //! generic times + /*! The step times are copied from the TimeGrid object + + \param timeGrid containts the times at which the steps + occur + */ BrownianBridge(const TimeGrid& timeGrid); //! \name inspectors //@{ Size size() const; const std::vector<Time>& times() const; //@} - //! \name Brownian-bridge constructor - //@{ + + //! \name Brownian-bridge generator function + /*! Transforms an input sequence of variates into a sequence + of variations in a Brownian bridge path. + + \param begin, end define the input sequence. The first + element of this sequence defines the slope of the whole + Brownian bridge. The rest of the elements of the sequence + are Gaussain random numbers. + + \param output defines the output sequence + + \note To get the connonical Brownian bridge which starts + and finishes at the same value, the first element of input + sequence must be zero. Conversly to get a sloped bridge, + set the first element to a non-zero value. In this case, + the final value in the bridge will be sqrt(last time + point)*(first element of input sequence). + */ template <class RandomAccessIterator1, class RandomAccessIterator2> void transform(RandomAccessIterator1 begin, -- Bojan Nikolic || http://www.bnikolic.co.uk ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Wed, 2009-02-25 at 08:05 +0000, Bojan Nikolic wrote:
> Attached is a short patch that should make it clearer how to use the > Brownian bridge class. Applied, thanks. Luigi -- Cogito ergo I'm right and you're wrong. -- Blair Houghton ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |