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

#include <ored/model/calibrationpointcache.hpp>

+ Collaboration diagram for CalibrationPointCache:

Public Member Functions

bool hasChanged (const std::vector< std::vector< Real > > &curveTimes, const std::vector< std::vector< Real > > &curveData, const std::vector< std::vector< std::pair< Real, Real > > > &volTimesStrikes, const std::vector< std::vector< Real > > &volData, const bool updateCache)
 

Private Attributes

Date referenceDate_
 
std::vector< std::vector< Real > > curveTimes_
 
std::vector< std::vector< std::pair< Real, Real > > > volTimesStrikes_
 
std::vector< std::vector< Real > > curveData_
 
std::vector< std::vector< Real > > volData_
 

Detailed Description

Definition at line 35 of file calibrationpointcache.hpp.

Member Function Documentation

◆ hasChanged()

bool hasChanged ( const std::vector< std::vector< Real > > &  curveTimes,
const std::vector< std::vector< Real > > &  curveData,
const std::vector< std::vector< std::pair< Real, Real > > > &  volTimesStrikes,
const std::vector< std::vector< Real > > &  volData,
const bool  updateCache 
)

Definition at line 26 of file calibrationpointcache.cpp.

29 {
30
31 bool dirty = false;
32
33 // check for changes in the times/strikes or data
34
35 dirty = dirty || curveTimes.size() != curveTimes_.size();
36 dirty = dirty || curveData.size() != curveData_.size();
37 dirty = dirty || volTimesStrikes.size() != volTimesStrikes_.size();
38 dirty = dirty || volData.size() != volData_.size();
39
40 for (Size i = 0; i < curveTimes.size() && !dirty; ++i) {
41 dirty = dirty || (curveTimes[i].size() != curveTimes_[i].size());
42 for (Size j = 0; j < curveTimes[i].size() && !dirty; ++j) {
43 dirty = dirty || curveTimes[i][j] != curveTimes_[i][j];
44 }
45 }
46
47 for (Size i = 0; i < curveData.size() && !dirty; ++i) {
48 dirty = dirty || (curveData[i].size() != curveData_[i].size());
49 for (Size j = 0; j < curveData[i].size() && !dirty; ++j) {
50 dirty = dirty || curveData[i][j] != curveData_[i][j];
51 }
52 }
53
54 for (Size i = 0; i < volTimesStrikes.size() && !dirty; ++i) {
55 dirty = dirty || (volTimesStrikes[i].size() != volTimesStrikes_[i].size());
56 for (Size j = 0; j < volTimesStrikes[i].size() && !dirty; ++j) {
57 dirty = dirty || volTimesStrikes[i][j].first != volTimesStrikes_[i][j].first;
58 dirty = dirty || volTimesStrikes[i][j].second != volTimesStrikes_[i][j].second;
59 }
60 }
61
62 for (Size i = 0; i < volData.size() && !dirty; ++i) {
63 dirty = dirty || (volData[i].size() != volData_[i].size());
64 for (Size j = 0; j < volData[i].size() && !dirty; ++j) {
65 dirty = dirty || volData[i][j] != volData_[i][j];
66 }
67 }
68
69 // if dirty update reference results if requested
70
71 if (dirty && updateCache) {
72 curveTimes_ = curveTimes;
73 curveData_ = curveData;
74 volTimesStrikes_ = volTimesStrikes;
75 volData_ = volData;
76 }
77
78 return dirty;
79}
std::vector< std::vector< Real > > curveTimes_
std::vector< std::vector< std::pair< Real, Real > > > volTimesStrikes_
std::vector< std::vector< Real > > curveData_
std::vector< std::vector< Real > > volData_
+ Here is the caller graph for this function:

Member Data Documentation

◆ referenceDate_

Date referenceDate_
private

Definition at line 42 of file calibrationpointcache.hpp.

◆ curveTimes_

std::vector<std::vector<Real> > curveTimes_
private

Definition at line 43 of file calibrationpointcache.hpp.

◆ volTimesStrikes_

std::vector<std::vector<std::pair<Real, Real> > > volTimesStrikes_
private

Definition at line 44 of file calibrationpointcache.hpp.

◆ curveData_

std::vector<std::vector<Real> > curveData_
private

Definition at line 45 of file calibrationpointcache.hpp.

◆ volData_

std::vector<std::vector<Real> > volData_
private

Definition at line 45 of file calibrationpointcache.hpp.