QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
spherecylinder.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Mark Joshi
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
25#ifndef quantlib_optimization_sphere_cylinder_hpp
26#define quantlib_optimization_sphere_cylinder_hpp
27
28#include <ql/types.hpp>
29#include <vector>
30
31namespace QuantLib {
32
41 public:
43 Real s,
44 Real alpha,
45 Real z1,
46 Real z2,
47 Real z3,
48 Real zweight =1.0);
49 bool isIntersectionNonEmpty() const;
50 void findClosest(Size maxIterations,
51 Real tolerance,
52 Real& y1,
53 Real& y2,
54 Real& y3) const;
56 Real& y1,
57 Real& y2,
58 Real& y3) const;
59 private:
61 Real objectiveFunction(Real x2) const;
66 };
67
68 std::vector<Real> sphereCylinderOptimizerClosest(Real r,
69 Real s,
70 Real alpha,
71 Real z1,
72 Real z2,
73 Real z3,
74 Natural maxIterations,
75 Real tolerance,
76 Real finalWeight = 1.0);
77
78}
79
80#endif
void findClosest(Size maxIterations, Real tolerance, Real &y1, Real &y2, Real &y3) const
bool findByProjection(Real &y1, Real &y2, Real &y3) const
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
std::vector< Real > sphereCylinderOptimizerClosest(Real r, Real s, Real alpha, Real z1, Real z2, Real z3, Natural maxIterations, Real tolerance, Real zweight)