Coverage Report

Created: 2026-01-25 06:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/math/optimization/projection.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2007 François du Vignaud
5
 Copyright (C) 2007 Giorgio Facchinetti
6
 Copyright (C) 2013 Peter Caspers
7
8
 This file is part of QuantLib, a free-software/open-source library
9
 for financial quantitative analysts and developers - http://quantlib.org/
10
11
 QuantLib is free software: you can redistribute it and/or modify it
12
 under the terms of the QuantLib license.  You should have received a
13
 copy of the license along with this program; if not, please email
14
 <quantlib-dev@lists.sf.net>. The license is also available online at
15
 <https://www.quantlib.org/license.shtml>.
16
17
 This program is distributed in the hope that it will be useful, but WITHOUT
18
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 FOR A PARTICULAR PURPOSE.  See the license for more details.
20
*/
21
22
/*! \file projection.hpp
23
    \brief Parameter projection
24
*/
25
26
#ifndef quantlib_math_projection_h
27
#define quantlib_math_projection_h
28
29
#include <ql/math/array.hpp>
30
31
namespace QuantLib {
32
33
    class Projection {
34
      public:
35
        Projection(const Array& parameterValues,
36
                   std::vector<bool> fixParameters = std::vector<bool>());
37
38
        //! returns the subset of free parameters corresponding
39
        // to set of parameters
40
        virtual Array project(const Array &parameters) const;
41
42
        //! returns whole set of parameters corresponding to the set
43
        // of projected parameters
44
        virtual Array include(const Array &projectedParameters) const;
45
0
        virtual ~Projection() = default;
46
47
      protected:
48
        void mapFreeParameters(const Array &parameterValues) const;
49
        Size numberOfFreeParameters_ = 0;
50
        const Array fixedParameters_;
51
        mutable Array actualParameters_;
52
        std::vector<bool> fixParameters_;
53
    };
54
55
}
56
57
#endif