<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
Exception handling

Classes

struct  tlapack::EcOpts
 Options for error checking. More...
 
struct  tlapack::ErrorCheck
 Descriptor for Exception Handling. More...
 

Macros

#define tlapack_check(cond)
 Throw an error if cond is false.
 
#define tlapack_check_false(cond)
 Throw an error if cond is true.
 
#define TLAPACK_DEFAULT_INFCHECK   true
 Default behavior of checks for Infs.
 
#define TLAPACK_DEFAULT_NANCHECK   true
 Default behavior of checks for NaNs.
 
#define tlapack_error(info, detailedInfo)
 Error handler.
 
#define tlapack_error_if(cond, info, detailedInfo)
 Error handler with conditional.
 
#define tlapack_warning(info, detailedInfo)
 Warning handler.
 

Functions

std::string tlapack::internal::error_msg (int info, const std::string &detailedInfo)
 Create a string with the error message.
 
template<TLAPACK_MATRIX matrix_t>
bool tlapack::hasinf (BandAccess accessType, const matrix_t &A) noexcept
 Returns true if and only if A has an infinite entry.
 
template<TLAPACK_VECTOR vector_t>
bool tlapack::hasinf (const vector_t &x) noexcept
 Returns true if and only if x has an infinite entry.
 
template<TLAPACK_UPLO uplo_t, TLAPACK_MATRIX matrix_t>
bool tlapack::hasinf (uplo_t uplo, const matrix_t &A)
 Returns true if and only if A has an infinite entry.
 
template<TLAPACK_MATRIX matrix_t>
bool tlapack::hasnan (BandAccess accessType, const matrix_t &A) noexcept
 Returns true if and only if A has an NaN entry.
 
template<TLAPACK_VECTOR vector_t>
bool tlapack::hasnan (const vector_t &x) noexcept
 Returns true if and only if x has an NaN entry.
 
template<TLAPACK_UPLO uplo_t, TLAPACK_MATRIX matrix_t>
bool tlapack::hasnan (uplo_t uplo, const matrix_t &A)
 Returns true if and only if A has an NaN entry.
 

Variables

constexpr ErrorCheck tlapack::NO_ERROR_CHECK = {false, false, false}
 Options to disable error checking.
 

Detailed Description


Macro Definition Documentation

◆ tlapack_check

#define tlapack_check (   cond)
Value:
do { \
if (!static_cast<bool>(cond)) throw std::domain_error(#cond); \
} while (false)

Throw an error if cond is false.

ex: lapack_check( 1 > 2 ); throws an error.

Note
Disable the check by defining TLAPACK_NDEBUG or undefining TLAPACK_CHECK_INPUT.

◆ tlapack_check_false

#define tlapack_check_false (   cond)
Value:
do { \
if (static_cast<bool>(cond)) throw std::domain_error(#cond); \
} while (false)

Throw an error if cond is true.

ex: tlapack_check_false( 1 < 2 ); throws an error.

Note
Disable the check by defining TLAPACK_NDEBUG or undefining TLAPACK_CHECK_INPUT.

◆ TLAPACK_DEFAULT_INFCHECK

#define TLAPACK_DEFAULT_INFCHECK   true

Default behavior of checks for Infs.

Checks can be activated/deactivated at runtime

◆ TLAPACK_DEFAULT_NANCHECK

#define TLAPACK_DEFAULT_NANCHECK   true

Default behavior of checks for NaNs.

Checks can be activated/deactivated at runtime

◆ tlapack_error

#define tlapack_error (   info,
  detailedInfo 
)
Value:
throw std::runtime_error( \
tlapack::internal::error_msg(info, detailedInfo))
std::string error_msg(int info, const std::string &detailedInfo)
Create a string with the error message.
Definition exceptionHandling.hpp:50

Error handler.

Parameters
[in]infoCode of the error.
[in]detailedInfoString with information about the error.
Note
Disable the handler by defining TLAPACK_NDEBUG.

◆ tlapack_error_if

#define tlapack_error_if (   cond,
  info,
  detailedInfo 
)
Value:
do { \
if (static_cast<bool>(cond)) tlapack_error(info, detailedInfo); \
} while (false)
#define tlapack_error(info, detailedInfo)
Error handler.
Definition exceptionHandling.hpp:142

Error handler with conditional.

Parameters
[in]condIf true, tlapack error is thrown.
[in]infoCode of the error.
[in]detailedInfoString with information about the error.
Note
Disable the handler by defining TLAPACK_NDEBUG.

◆ tlapack_warning

#define tlapack_warning (   info,
  detailedInfo 
)
Value:
std::cerr << tlapack::internal::error_msg(info, detailedInfo) \
<< std::endl;

Warning handler.

Parameters
[in]infoCode of the warning.
[in]detailedInfoString with information about the warning.
Note
Disable the handler by defining TLAPACK_NDEBUG.

Function Documentation

◆ error_msg()

std::string tlapack::internal::error_msg ( int  info,
const std::string &  detailedInfo 
)
inline

Create a string with the error message.

Parameters
infoError code.
detailedInfoDetails about the error.
Returns
std::string Final error message.

◆ hasinf() [1/3]

template<TLAPACK_MATRIX matrix_t>
bool tlapack::hasinf ( BandAccess  accessType,
const matrix_t A 
)
noexcept

Returns true if and only if A has an infinite entry.

Specific implementation for band access types.

See also
tlapack::hasinf(uplo_t uplo, const matrix_t& A).

◆ hasinf() [2/3]

template<TLAPACK_VECTOR vector_t>
bool tlapack::hasinf ( const vector_t x)
noexcept

Returns true if and only if x has an infinite entry.

Parameters
[in]xvector.
Returns
true if x has an infinite entry.
false if x has no infinite entry.

◆ hasinf() [3/3]

template<TLAPACK_UPLO uplo_t, TLAPACK_MATRIX matrix_t>
bool tlapack::hasinf ( uplo_t  uplo,
const matrix_t A 
)

Returns true if and only if A has an infinite entry.

Template Parameters
uplo_tType of access inside the algorithm. Either Uplo or any type that implements operator Uplo().
Parameters
[in]uploDetermines the entries of A that will be checked. The following access types are allowed: Uplo::General, Uplo::UpperHessenberg, Uplo::LowerHessenberg, Uplo::Upper, Uplo::Lower, Uplo::StrictUpper, Uplo::StrictLower.
[in]Amatrix.
Returns
true if A has an infinite entry.
false if A has no infinite entry.

◆ hasnan() [1/3]

template<TLAPACK_MATRIX matrix_t>
bool tlapack::hasnan ( BandAccess  accessType,
const matrix_t A 
)
noexcept

Returns true if and only if A has an NaN entry.

Specific implementation for band access types.

See also
tlapack::hasnan(uplo_t uplo, const matrix_t& A).

◆ hasnan() [2/3]

template<TLAPACK_VECTOR vector_t>
bool tlapack::hasnan ( const vector_t x)
noexcept

Returns true if and only if x has an NaN entry.

Parameters
[in]xvector.
Returns
true if x has an NaN entry.
false if x has no NaN entry.

◆ hasnan() [3/3]

template<TLAPACK_UPLO uplo_t, TLAPACK_MATRIX matrix_t>
bool tlapack::hasnan ( uplo_t  uplo,
const matrix_t A 
)

Returns true if and only if A has an NaN entry.

Template Parameters
uplo_tType of access inside the algorithm. Either Uplo or any type that implements operator Uplo().
Parameters
[in]uploDetermines the entries of A that will be checked. The following access types are allowed: Uplo::General, Uplo::UpperHessenberg, Uplo::LowerHessenberg, Uplo::Upper, Uplo::Lower, Uplo::StrictUpper, Uplo::StrictLower.
[in]Amatrix.
Returns
true if A has an NaN entry.
false if A has no NaN entry.