Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ProjectedBufferedMultiPathGenerator Class Reference

#include <qle/methods/projectedbufferedmultipathgenerator.hpp>

+ Inheritance diagram for ProjectedBufferedMultiPathGenerator:
+ Collaboration diagram for ProjectedBufferedMultiPathGenerator:

Public Member Functions

 ProjectedBufferedMultiPathGenerator (const std::vector< Size > &stateProcessProjection, const QuantLib::ext::shared_ptr< std::vector< std::vector< QuantLib::Path > > > &bufferedPaths)
 
const Sample< MultiPath > & next () const override
 
void reset () override
 
- Public Member Functions inherited from MultiPathGeneratorBase
virtual ~MultiPathGeneratorBase ()
 
virtual const Sample< MultiPath > & next () const =0
 
virtual void reset ()=0
 

Private Attributes

const std::vector< Size > stateProcessProjection_
 
const QuantLib::ext::shared_ptr< std::vector< std::vector< QuantLib::Path > > > bufferedPaths_
 
Size maxTargetIndex_
 
Size currentPath_
 
Sample< MultiPath > next_
 

Detailed Description

Definition at line 33 of file projectedbufferedmultipathgenerator.hpp.

Constructor & Destructor Documentation

◆ ProjectedBufferedMultiPathGenerator()

ProjectedBufferedMultiPathGenerator ( const std::vector< Size > &  stateProcessProjection,
const QuantLib::ext::shared_ptr< std::vector< std::vector< QuantLib::Path > > > &  bufferedPaths 
)

If projection(j) = i for state process indices i from the projected process and j from the original process, then stateProcessProjection[i] = j, i.e. a state process component index from the projected model is mapped to the state process component index of the original model.

Definition at line 23 of file projectedbufferedmultipathgenerator.cpp.

26 : stateProcessProjection_(stateProcessProjection), bufferedPaths_(bufferedPaths), next_(MultiPath(), 1.0) {
27
28 QL_REQUIRE(bufferedPaths_, "ProjectedBufferedMultiPathGenerator: no buffered paths given (null)");
29 QL_REQUIRE(!bufferedPaths_->empty(), "ProjectedBufferedMultiPathGenerator: at least one buffered path required");
30
31 QL_REQUIRE(!stateProcessProjection.empty(),
32 "ProjectedBufferedMultiPathGenerator: state process projection is empty");
33
34 maxTargetIndex_ = *std::max_element(stateProcessProjection.begin(), stateProcessProjection.end());
35
36 reset();
37}
const QuantLib::ext::shared_ptr< std::vector< std::vector< QuantLib::Path > > > bufferedPaths_
+ Here is the call graph for this function:

Member Function Documentation

◆ next()

const Sample< MultiPath > & next ( ) const
overridevirtual

Implements MultiPathGeneratorBase.

Definition at line 39 of file projectedbufferedmultipathgenerator.cpp.

39 {
40 QL_REQUIRE(currentPath_ < bufferedPaths_->size(),
41 "ProjectedBufferedMultiPathGenerator: run out of paths (" << bufferedPaths_->size() << ")");
42
43 QL_REQUIRE((*bufferedPaths_)[currentPath_].size() > maxTargetIndex_,
44 "ProjectedBufferedMultiPathGenerator: buffered path at sample "
45 << currentPath_ << " has insufficient dimension (" << (*bufferedPaths_)[currentPath_].size()
46 << "), need " << (maxTargetIndex_ + 1));
47
48 std::vector<Path> tmp;
49 for (Size d = 0; d < stateProcessProjection_.size(); ++d) {
51 }
52
54 next_.value = MultiPath(tmp);
55 return next_;
56}

◆ reset()

void reset ( )
overridevirtual

Implements MultiPathGeneratorBase.

Definition at line 58 of file projectedbufferedmultipathgenerator.cpp.

58{ currentPath_ = 0; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ stateProcessProjection_

const std::vector<Size> stateProcessProjection_
private

Definition at line 45 of file projectedbufferedmultipathgenerator.hpp.

◆ bufferedPaths_

const QuantLib::ext::shared_ptr<std::vector<std::vector<QuantLib::Path> > > bufferedPaths_
private

Definition at line 46 of file projectedbufferedmultipathgenerator.hpp.

◆ maxTargetIndex_

Size maxTargetIndex_
private

Definition at line 47 of file projectedbufferedmultipathgenerator.hpp.

◆ currentPath_

Size currentPath_
mutableprivate

Definition at line 48 of file projectedbufferedmultipathgenerator.hpp.

◆ next_

Sample<MultiPath> next_
mutableprivate

Definition at line 49 of file projectedbufferedmultipathgenerator.hpp.