ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/optimization/ConjugateGradient.cpp
Revision: 1741
Committed: Tue Jun 5 18:02:44 2012 UTC (12 years, 10 months ago) by gezelter
File size: 1518 byte(s)
Log Message:
Adding initial import of optimization library

File Contents

# Content
1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3 /*
4 Copyright (C) 2001, 2002, 2003 Nicolas Di Césaré
5 Copyright (C) 2007 Ferdinando Ametrano
6 Copyright (C) 2007 Marco Bianchetti
7 Copyright (C) 2007 François du Vignaud
8 Copyright (C) 2009 Frédéric Degraeve
9
10 This file is part of QuantLib, a free-software/open-source library
11 for financial quantitative analysts and developers - http://quantlib.org/
12
13 QuantLib is free software: you can redistribute it and/or modify it
14 under the terms of the QuantLib license. You should have received a
15 copy 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
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the license for more details.
22 */
23
24 #include "optimization/ConjugateGradient.hpp"
25 #include "optimization/Problem.hpp"
26 #include "optimization/LineSearch.hpp"
27
28 namespace QuantLib {
29
30 DynamicVector<RealType> ConjugateGradient::getUpdatedDirection(const Problem& P,
31 RealType gold2,
32 const DynamicVector<RealType>&) {
33 return -lineSearch_->lastGradient() +
34 (P.gradientNormValue() / gold2) * lineSearch_->searchDirection();
35 }
36
37 }

Properties

Name Value
svn:eol-style native