11.07.2015 Views

Beyond Simple Monte-Carlo: Parallel Computing with QuantLib

Beyond Simple Monte-Carlo: Parallel Computing with QuantLib

Beyond Simple Monte-Carlo: Parallel Computing with QuantLib

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Multi-Threading: <strong>Parallel</strong> Model CalibrationC++11 version of a parallel model calibration functionDisposableCalibrationFunction::values(const Array& params) const {model_->setParams(params);std::vector errorFcts;std::transform(std::begin(instruments_), std::end(instruments_),std::back_inserter(errorFcts),[](decltype(*begin(instruments_)) h) {return std::async(std::launch::async,&CalibrationHelper::calibrationError,h.get());});Array values(instruments_.size());std::transform(std::begin(errorFcts), std::end(errorFcts),values.begin(), [](std::future& f) { return f.get();});}return values;Klaus Spanderen<strong>Beyond</strong> <strong>Simple</strong> <strong>Monte</strong>-<strong>Carlo</strong>: <strong>Parallel</strong> <strong>Computing</strong> <strong>with</strong> <strong>QuantLib</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!