fixed *BUG* in Yong-Dian's (obsolete?) CG solver
parent
fad11c0f4b
commit
5ed0c6cc49
|
|
@ -193,7 +193,7 @@ boost::tuple<V, int> nonlinearConjugateGradient(const S &system,
|
|||
// Polak-Ribiere: beta = g'*(g_n-g_n-1)/g_n-1'*g_n-1
|
||||
const double beta = std::max(0.0,
|
||||
currentGradient.dot(currentGradient - prevGradient)
|
||||
/ currentGradient.dot(currentGradient));
|
||||
/ prevGradient.dot(prevGradient));
|
||||
direction = currentGradient + (beta * direction);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue