Re: Nonlinear CG
"Ben FrantzDale" <[email protected]> Tue, 16 Jan 2007 18:53:49 -0500
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============1567559369==
Content-Type: multipart/alternative;
boundary="----=_Part_91359_22147565.1168991629415"
------=_Part_91359_22147565.1168991629415
Content-Type: text/plain; charset=WINDOWS-1252; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
It appears that the two primary ways to make CG nonlinear is to change how
the line search is performed and how beta is determined. I'm invissioning a
nonlinear_cg() function that takes those options as function objects. That
is, you might call it like
nonlinear_cg(f, x, b, P, iter,
Secant(), FletcherReeves());
(See below for function objects for the two popular ways to compute beta.)
Some methods require only f', others require both f and f', others require
f' and f''. Any thoughts as to do that generically? One possibility would b=
e
for the operator() of f to take two, three, or four arguments. That is,
f(x, d) -> d =3D f(x)
f(x, d, g) -> d =3D f(x), g =3D f'(x)
f(x, d, g, H) -> d =3D f(x), g =3D f'(x), H =3D f''(x).
Other options include making derivative(f)(x, g) return g, but that seems a
bit too clever for its own good.
Thoughts?
=97Ben
template <typename Vector>
struct FletcherReeves {
double operator()(Vector const& r,
Vector const& r_next) const
{
return (itl::dot_conj(r_next, r_next)
/
itl::dot_conj(r, r));
}
};
template <typename Vector>
struct PolakRibiere {
double operator()(Vector const& r,
Vector const& r_next) const
{
Vector r_dif(itl::size(r));
itl::add(r_next, itl::scaled(r, -1.0), r_diff);
double const beata =3D (itl::dot_conj(r_next, r_diff)
/
itl::dot_conj(r, r));
return std::max(0.0, beta);
}
};
------=_Part_91359_22147565.1168991629415
Content-Type: text/html; charset=WINDOWS-1252
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
It appears that the two primary ways to make CG nonlinear is to change how =
the line search is performed and how beta is determined. I'm invissioni=
ng a nonlinear_cg() function that takes those options as function objects. =
That is, you might call it like
<br> nonlinear_cg(f, x, b, P, iter,<br> =
&nb=
sp; Secant(), FletcherReeves());<br><br>(See below for fu=
nction objects for the two popular ways to compute beta.)<br><br><br>Some m=
ethods require only f', others require both f and f', others requir=
e f' and f''. Any thoughts as to do that generically? One possi=
bility would be for the operator() of f to take two, three, or four argumen=
ts. That is,
<br> f(x, d) -> d =3D f(x)<br> f(x, d, g) -> d =3D f(x), =
g =3D f'(x)<br> f(x, d, g, H) -> d =3D f(x), g =3D f'(x), =
H =3D f''(x).<br><br>Other options include making derivative(f)(x, =
g) return g, but that seems a bit too clever for its own good.
<br><br>Thoughts?<br><br>=97Ben<br><br><br>template <typename Vector>=
<br>struct FletcherReeves {<br> double operator()(Vector const& r=
,<br> Vector const&=
amp; r_next) const<br> {<br> return (itl::dot_conj(=
r_next, r_next)
<br> /<br> &nb=
sp; itl::dot_conj(r, r));<br> }<br>};<br><br>template <typen=
ame Vector><br>struct PolakRibiere {<br> double operator()(Vector =
const& r,<br> V=
ector const& r_next) const<br> {
<br> Vector r_dif(itl::size(r));<br> it=
l::add(r_next, itl::scaled(r, -1.0), r_diff);<br><br> dou=
ble const beata =3D (itl::dot_conj(r_next, r_diff)<br> &n=
bsp; /<br> &n=
bsp; itl::dot_conj(r, r));<br> &=
nbsp; return std::max(
0.0, beta);<br> }<br>};<br><br><br><br>
------=_Part_91359_22147565.1168991629415--
--===============1567559369==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
--===============1567559369==--