Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::ISNSANE< T > Struct Template Reference

\( f(x) =\begin{cases} \mathrm{true\ if}\ |x| > 10^{100}\\ \mathrm{false\ else} \end{cases}\) More...

Public Member Functions

bool operator() (T x)
 

Detailed Description

template<class T>
struct dg::ISNSANE< T >

\( f(x) =\begin{cases} \mathrm{true\ if}\ |x| > 10^{100}\\ \mathrm{false\ else} \end{cases}\)

Also return true if x is NaN or Inf. The intention is to use this in the reduce function to debug code if you get an error message of Inf or Nan from the dot function

//Check if a vector contains is sane
thrust::device_vector<double> x( 100);
bool hasnan = dg::blas1::reduce( x, false, thrust::logical_or<bool>(),
std::cout << "x contains insane numbers "<<std::boolalpha<<hasnan<<"\n";
OutputType reduce(const ContainerType &x, OutputType zero, BinaryOp binary_op, UnaryOp unary_op=UnaryOp())
Custom (transform) reduction
Definition: blas1.h:139
@ x
x direction
Definition: functors.h:265

Member Function Documentation

◆ operator()()

template<class T >
bool dg::ISNSANE< T >::operator() ( x)
inline

The documentation for this struct was generated from the following file: