22 #ifndef _BLAZE_MATH_SOLVERS_PGS_H_
23 #define _BLAZE_MATH_SOLVERS_PGS_H_
72 template<
typename CP >
bool solve( CP& cp );
80 template<
typename CP >
inline real sweep( CP& cp )
const;
112 template<
typename CP >
115 const size_t n( cp.size() );
117 bool converged(
false );
123 for(
size_t i=0; i<n; ++i ) {
124 const real tmp( A(i,i) );
130 for(
size_t i=0; i<n; ++i ) {
150 log <<
" Solved the complementarity problem in " << it <<
" PGS iterations.";
170 template<
typename CP >
173 real maxResidual( 0 ), xold( 0 );
174 const size_t n( cp.size() );
177 const VecN& b( cp.b_ );
180 for(
size_t i=0; i<n; ++i )
182 const real residual( - b[i] - ( A * x )[i] );
188 maxResidual =
max( maxResidual,
std::fabs( xold - x[i] ) );
208 const size_t N( cp.
size() / 3 );
209 real rmax( 0 ), residual, flimit, aux;
216 for(
size_t i=0; i<N; ++i )
219 residual = -b[j] - ( A * x )[j];
224 flimit = cp.
cof_[i] * x[j];
227 residual = -b[j] - ( A * x )[j];
233 residual = -b[j] - ( A * x )[j];
254 #if !defined(_MSC_VER)
255 extern template bool PGS::solve<LCP>(
LCP& );
256 extern template bool PGS::solve<BoxLCP>(
BoxLCP& );
257 extern template bool PGS::solve<ContactLCP>(
ContactLCP& );