OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
ConjugateGradient.cpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4Copyright (C) 2001, 2002, 2003 Nicolas Di Césaré
5Copyright (C) 2007 Ferdinando Ametrano
6Copyright (C) 2007 Marco Bianchetti
7Copyright (C) 2007 François du Vignaud
8Copyright (C) 2009 Frédéric Degraeve
9
10This file is part of QuantLib, a free-software/open-source library
11for financial quantitative analysts and developers - http://quantlib.org/
12
13QuantLib is free software: you can redistribute it and/or modify it
14under the terms of the QuantLib license. You should have received a
15copy of the license along with this program; if not, please email
16<quantlib-dev@lists.sf.net>. The license is also available online at
17<http://quantlib.org/license.shtml>.
18
19This program is distributed in the hope that it will be useful, but WITHOUT
20ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21FOR A PARTICULAR PURPOSE. See the license for more details.
22*/
23
25
28
29namespace QuantLib {
30
31 DynamicVector<RealType> ConjugateGradient::getUpdatedDirection(
32 const Problem& P, RealType gold2, const DynamicVector<RealType>&) {
33 return -lineSearch_->lastGradient() +
34 (P.gradientNormValue() / gold2) * lineSearch_->searchDirection();
35 }
36
37} // namespace QuantLib
Conjugate gradient optimization method.
Line search abstract class.
Abstract optimization problem class.
Dynamically-sized vector class.
const DynamicVector< RealType > & searchDirection() const
current value of the search direction
const DynamicVector< RealType > & lastGradient()
return last gradient