Posted by
Simon Ibbotson-2 on
URL: http://quantlib.414.s1.nabble.com/Returning-multiple-values-from-a-Monte-Carlo-pricing-engine-tp9175p9177.html
The problem is that MonteCarloModel::addSamples(Size samples) does some
simple arithmetic operations on the result_type. Also,
McSimulation::value() and McSimulation::calculate() do some other simple
operations.
In the short-term, I've fully specialised the addSamples() function and
defined some arithmetic operations for std::vector<double>.
In the long-term, I'd prefer a cleaner solution.
I'd suggest making GenericSequenceStatistics into a double template
class - GenericRiskStatistics<GaussianStatistics,template <class> class
TVector = std::vector> and create a specific TVector class for
MonteCarlo simulations.
What do you think?
Simon
> Then either
>
> a) Define arithmetic operations for the VECTOR return type or
>
> b) Write parts of MonteCarloModel specialised (via class
> template) for the particular traits class.
No, I don't think you need to do that. SequenceStatistics doesn't do
statistics on the passed vectors as such, it just maintains a set of 1-D
statistics. This part should just work.
Let me know how it goes,
Luigi
This communication and any attachments contains information which is confidential and may be subject to legal privilege. It is for intended recipients only. If you are not the intended recipient you must not copy, distribute, publish, rely on or otherwise use it without our consent. Some of our communications may contain confidential information which it could be a criminal offence for you to disclose or use without authority. If you have received this email in error please notify
[hidden email] immediately and delete the email from your computer.
The FSA reserves the right to monitor all email communications for compliance with legal, regulatory and professional standards.
This email is not intended to nor should it be taken to create any legal relations or contractual relationships. This email has originated from
The Financial Services Authority (FSA)
25 The North Colonnade,
Canary Wharf,
London
E14 5HS
United Kingdom
Registered as a Limited Company in England and Wales No.1920623.
Registered Office as above
Switchboard: 020 7066 1000
Web Site:
http://www.fsa.gov.uk*****************************************************************
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev