/usr/include/rheolef/damped_newton.h is in librheolef-dev 6.5-1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # ifndef _RHEO_DAMPED_NEWTON_H
# define _RHEO_DAMPED_NEWTON_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// =========================================================================
#include "rheolef/damped-newton-generic.h"
namespace rheolef {
/*Class:damped_newton
NAME: @code{damped_newton} -- damped Newton nonlinear algorithm
@findex damped\_newton
@cindex nonlinear problem
@cindex Newton method
DESCRIPTION:
@noindent
Nonlinear damped Newton algorithm for the resolution of the following problem:
@example
F(u) = 0
@end example
A simple call to the algorithm writes:
@example
my_problem P;
field uh (Vh);
damped_newton (P, uh, tol, max_iter);
@end example
In addition to the members required for the Newton algorithm (@pxref{newton algorithm}),
the @code{space_norm} and @code{duality_product} are required for
the damped Newton line search algorithm:
@example
class my_problem @{
public:
...
Float space_norm (const field& uh) const;
Float duality_product (const field& mrh, const field& msh) const;
@};
@end example
AUTHOR:
| Pierre.Saramito@imag.fr
LJK, 38041 Grenoble cedex 9, France
DATE: 14 oct 2009
METHODS: @newton
End:
*/
struct newton_identity_preconditioner {
template <class Problem>
Float operator() (const Problem& P, const typename Problem::value_type& MFv) const {
return 0.5*P.duality_product (MFv,MFv);
}
template <class Problem>
Float operator() (const Problem& P, const typename Problem::value_type& MFu, const typename Problem::value_type& delta_u) const {
return operator() (P, MFu);
}
template <class Problem>
typename Problem::value_type grad (const Problem& P, const typename Problem::value_type& MFu) const {
return P.derivative_trans_mult (MFu);
}
template <class Problem>
Float slope (const Problem& P, const typename Problem::value_type& MFu, const typename Problem::value_type& delta_u) const {
return -P.duality_product (MFu,MFu);
}
};
//<damped_newton:
template <class Problem, class Field, class Real, class Size>
int damped_newton (Problem P, Field& u, Real& tol, Size& max_iter, odiststream* p_derr=0) {
return damped_newton(P, newton_identity_preconditioner(), u, tol, max_iter, p_derr);
}
//>damped_newton:
}// namespace rheolef
# endif // _RHEO_DAMPED_NEWTON_H
|