QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
piecewiseconstantcorrelation.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Ferdinando Ametrano
5 Copyright (C) 2007 Mark Joshi
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21#ifndef quantlib_piecewise_constant_correlation_hpp
22#define quantlib_piecewise_constant_correlation_hpp
23
24#include <ql/math/matrix.hpp>
25#include <vector>
26
27namespace QuantLib {
28
29 class Matrix;
30
31 // corrTimes must include all rateTimes but the last
33 public:
34 virtual ~PiecewiseConstantCorrelation() = default;
35 virtual const std::vector<Time>& times() const = 0;
36 virtual const std::vector<Time>& rateTimes() const = 0;
37 virtual const std::vector<Matrix>& correlations() const = 0;
38 virtual const Matrix& correlation(Size i) const;
39 virtual Size numberOfRates() const = 0;
40 };
41
42 inline const Matrix&
44 const std::vector<Matrix>& results = correlations();
45 QL_REQUIRE(i<results.size(),
46 "index (" << i <<
47 ") must be less than correlations vector size (" <<
48 results.size() << ")");
49 return results[i];
50 }
51
52}
53
54#endif
Matrix used in linear algebra.
Definition: matrix.hpp:41
virtual const std::vector< Matrix > & correlations() const =0
virtual const Matrix & correlation(Size i) const
virtual const std::vector< Time > & rateTimes() const =0
virtual Size numberOfRates() const =0
virtual ~PiecewiseConstantCorrelation()=default
virtual const std::vector< Time > & times() const =0
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35