Skip to content

Commit 9ebc716

Browse files
pcaspersjenkins
authored andcommitted
QPR-12398 fix, better handling
1 parent 3faf529 commit 9ebc716

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

OREData/ored/scripting/models/gaussiancam.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,25 +197,26 @@ void GaussianCam::performCalculations() const {
197197
}
198198

199199
indexPositionInProcess_.clear();
200-
eqIndexInCam_.clear();
201-
comIndexInCam_.clear();
200+
eqIndexInCam_.resize(indices_.size());
201+
comIndexInCam_.resize(indices_.size());
202+
std::fill(eqIndexInCam_.begin(), eqIndexInCam_.end(), Null<Size>());
203+
std::fill(comIndexInCam_.begin(), comIndexInCam_.end(), Null<Size>());
202204
for (Size i = 0; i < indices_.size(); ++i) {
203205
if (indices_[i].isFx()) {
204206
// FX
205207
Size ccyIdx = cam_->ccyIndex(parseCurrency(indexCurrencies_[i]));
206208
QL_REQUIRE(ccyIdx > 0, "fx index '" << indices_[i] << "' has unexpected for ccy = base ccy");
207209
indexPositionInProcess_.push_back(cam_->pIdx(CrossAssetModel::AssetType::FX, ccyIdx - 1));
208-
eqIndexInCam_.push_back(Null<Size>());
209210
} else if (indices_[i].isEq()) {
210211
// EQ
211212
Size eqIdx = cam_->eqIndex(indices_[i].eq()->name());
212213
indexPositionInProcess_.push_back(cam_->pIdx(CrossAssetModel::AssetType::EQ, eqIdx));
213-
eqIndexInCam_.push_back(eqIdx);
214+
eqIndexInCam_[i] = eqIdx;
214215
} else if(indices_[i].isComm()) {
215216
// COM
216217
Size comIdx = cam_->comIndex(indices_[i].commName());
217218
indexPositionInProcess_.push_back(cam_->pIdx(CrossAssetModel::AssetType::COM, comIdx));
218-
comIndexInCam_.push_back(comIdx);
219+
comIndexInCam_[i] = comIdx;
219220
} else {
220221
QL_FAIL("GuassianCam::performCalculations(): index '" << indices_[i].name()
221222
<< "' expected to be FX, EQ, COMM");

0 commit comments

Comments
 (0)