missed two templates

release/4.3a0
Varun Agrawal 2024-10-19 17:03:15 -04:00
parent 07b11bc9f1
commit 7bb98946a2
1 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ double HestenesStiefel(const Gradient &currentGradient,
const Gradient &prevGradient, const Gradient &prevGradient,
const Gradient &direction) { const Gradient &direction) {
// Hestenes-Stiefel: beta = g_n'*(g_n-g_n-1)/(-s_n-1')*(g_n-g_n-1) // Hestenes-Stiefel: beta = g_n'*(g_n-g_n-1)/(-s_n-1')*(g_n-g_n-1)
VectorValues d = currentGradient - prevGradient; Gradient d = currentGradient - prevGradient;
const double beta = std::max(0.0, currentGradient.dot(d) / -direction.dot(d)); const double beta = std::max(0.0, currentGradient.dot(d) / -direction.dot(d));
return beta; return beta;
} }
@ -59,7 +59,7 @@ double HestenesStiefel(const Gradient &currentGradient,
/// The Dai-Yuan formula for computing β, the direction of steepest descent. /// The Dai-Yuan formula for computing β, the direction of steepest descent.
template <typename Gradient> template <typename Gradient>
double DaiYuan(const Gradient &currentGradient, const Gradient &prevGradient, double DaiYuan(const Gradient &currentGradient, const Gradient &prevGradient,
const VectorValues &direction) { const Gradient &direction) {
// Dai-Yuan: beta = g_n'*g_n/(-s_n-1')*(g_n-g_n-1) // Dai-Yuan: beta = g_n'*g_n/(-s_n-1')*(g_n-g_n-1)
const double beta = const double beta =
std::max(0.0, currentGradient.dot(currentGradient) / std::max(0.0, currentGradient.dot(currentGradient) /