Loading src/TNL/Math.h +18 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,24 @@ T sign( const T& a ) return ( T ) 1; } template< class T > __cuda_callable__ bool isNan( const T& v ) { #if defined HAVE_CUDA #if defined(__CUDA_ARCH__) return isnan( v ); #else #if defined (__GNUC__) && ( __GNUC__ < 5 ) return false; #else return std::isnan( v ); #endif #endif #else return std::isnan( v ); #endif } template< typename Real > __cuda_callable__ bool isSmall( const Real& v, Loading src/TNL/Solvers/IterativeSolver_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ bool IterativeSolver< Real, Index> :: checkNextIteration() { this->refreshSolverMonitor(); if( std::isnan( this->getResidue() ) || if( isNan( this->getResidue() ) || this->getIterations() > this->getMaxIterations() || ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() >= this->getMinIterations() ) || ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() >= this->getMinIterations() ) ) Loading @@ -120,7 +120,7 @@ bool IterativeSolver< Real, Index>:: checkConvergence() { if( std::isnan( this->getResidue() ) ) if( isNan( this->getResidue() ) ) { std::cerr << std::endl << "The residue is NaN." << std::endl; return false; Loading src/TNL/Solvers/Linear/BICGStabL_impl.h +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ BICGStabL< Matrix >::solve( ConstVectorViewType b, VectorViewType x ) } sigma[ 0 ] = r_0.lpNorm( 2.0 ); if( std::isnan( sigma[ 0 ] ) ) if( isNan( sigma[ 0 ] ) ) throw std::runtime_error( "BiCGstab(ell): initial residue is NAN" ); r_ast = r_0; Loading Loading
src/TNL/Math.h +18 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,24 @@ T sign( const T& a ) return ( T ) 1; } template< class T > __cuda_callable__ bool isNan( const T& v ) { #if defined HAVE_CUDA #if defined(__CUDA_ARCH__) return isnan( v ); #else #if defined (__GNUC__) && ( __GNUC__ < 5 ) return false; #else return std::isnan( v ); #endif #endif #else return std::isnan( v ); #endif } template< typename Real > __cuda_callable__ bool isSmall( const Real& v, Loading
src/TNL/Solvers/IterativeSolver_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ bool IterativeSolver< Real, Index> :: checkNextIteration() { this->refreshSolverMonitor(); if( std::isnan( this->getResidue() ) || if( isNan( this->getResidue() ) || this->getIterations() > this->getMaxIterations() || ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() >= this->getMinIterations() ) || ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() >= this->getMinIterations() ) ) Loading @@ -120,7 +120,7 @@ bool IterativeSolver< Real, Index>:: checkConvergence() { if( std::isnan( this->getResidue() ) ) if( isNan( this->getResidue() ) ) { std::cerr << std::endl << "The residue is NaN." << std::endl; return false; Loading
src/TNL/Solvers/Linear/BICGStabL_impl.h +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ BICGStabL< Matrix >::solve( ConstVectorViewType b, VectorViewType x ) } sigma[ 0 ] = r_0.lpNorm( 2.0 ); if( std::isnan( sigma[ 0 ] ) ) if( isNan( sigma[ 0 ] ) ) throw std::runtime_error( "BiCGstab(ell): initial residue is NAN" ); r_ast = r_0; Loading