📄 error.h
字号:
class scythe_invalid_arg:public scythe_exception { public: scythe_invalid_arg (const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE_INVALID ARGUMENT", file, function, line, message, halt) { } }; /*! * \brief File i/o error. * * Library members throw this exception when errors occur during * file reading, writing, or creation, such as when one passes an * invalid file name to the Matrix class's save method. */ class scythe_file_error:public scythe_exception { public: scythe_file_error(const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE FILE ERROR", file, function, line, message, halt) { } }; /*! \brief Matrix conformation error. * * Library members throw this exception when a caller passes * non-conforming matrices (matrices of incompatible dimensions) to * a routine, such as when one attempt two row vectors. */ class scythe_conformation_error:public scythe_exception { public: scythe_conformation_error(const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE CONFORMATION ERROR", file, function, line, message, halt) { } }; /*! \brief Matrix dimension error. * * Library members throw this exception when a caller passes a * Matrix of the wrong size or shape to a routine. For example, * trying to take the Cholesky decomposition of a non-square Matrix * causes this error. */ class scythe_dimension_error:public scythe_exception { public: scythe_dimension_error (const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE DIMENSION ERROR", file, function, line, message, halt) { } }; /*! \brief Null Matrix error. * * Library members throw this exception when a caller passes a null * Matrix to a routine when it expects a non-null argument. For * example, taking the inverse of a null Matrix is impossible, * resulting in this exception. */ class scythe_null_error:public scythe_exception { public: scythe_null_error(const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE NULL ERROR", file, function, line, message, halt) { } }; /*! \brief Matrix type error. * * Library members throw this exception when a caller passes a * Matrix that does not satisfy some required property to a routine. * For example, Cholesky decomposition is designed to work on * positive definite matrices; trying to perform Cholesky * decomposition on a Matrix that does not satisfy this requirement * causes this exception. */ class scythe_type_error:public scythe_exception { public: scythe_type_error(const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE TYPE ERROR", file, function, line, message, halt) { } }; /*! \brief Element out of bounds error. * * Library members throw this exception when a caller attempts to * access an element outside the bounds of a data structure, such as * when one tries to access the 1000th element of a 200-element * Matrix. */ class scythe_bounds_error:public scythe_exception { public: scythe_bounds_error(const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE BOUNDS ERROR", file, function, line, message, halt) { } }; /*! \brief Numerical convergence error. * * Library members throw this exception when a numerical algorithm * fails to converge to a stable value. For example, the BFGS * optimization routine throws this exception when it cannot locate * the minimum of a function to a given tolerance. */ class scythe_convergence_error:public scythe_exception { public: scythe_convergence_error (const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE CONVERGENCE ERROR", file, function, line, message, halt) { } }; /*! \brief Numerical underflow or overflow error. * * Library members throw this exception when the result of a * calculation, assignment, or other operation is to small or large * for the data type holding the value. For example, passing * certain values to the gammafn function can result in underflow or * overflow conditions in the resulting calculations. */ class scythe_range_error:public scythe_exception { public: scythe_range_error (const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE RANGE ERROR", file, function, line, message, halt) { } }; /*! \brief Numerical precision error. * * Library members throw this exception when a routine cannot * complete a computation effectively and will sacrifice reasonable * precision as a consequence. For example, passing a value too * close to a negative integer to the gammafn function renders the * function incapable of returning an accurate result and thus * generates this exception. */ class scythe_precision_error:public scythe_exception { public: scythe_precision_error (const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE PRECISION ERROR", file, function, line, message, halt) { } }; /*! \brief Random number seed error. * * Library members throw this exception when a random number * generator is provided with an illegitimate starting seed value. * For example, the lecuyer class requires seeds within a certain * range to operate properly and will throw this exception when * seeded with a number outside of that range. */ class scythe_randseed_error:public scythe_exception { public: scythe_randseed_error(const std::string & file, const std::string & function, const unsigned int &line, const std::string & message = "", const bool & halt = false) throw () : scythe_exception ("SCYTHE RANDOM SEED ERROR", file, function, line, message, halt) { } }; /*! \brief Matrix style error. * * Library members throw this exception when they are asked to * operate on a Matrix of the incorrect style. Some routines * require specifically a concrete Matrix or view to work correctly. * For example, only views may reference other matrices; invoking * the reference function on a concrete Matrix will generate this * exception. */ class scythe_style_error:public scythe_exception { public: scythe_style_error(const std::string& file, const std::string& function, const unsigned int& line, const std::string& message = "", const bool& halt = false) throw () : scythe_exception("SCYTHE STYLE ERROR", file, function, line, message, halt) {} }; /*! \brief LAPACK Internal Error * * Library members throw this exception when an underlying LAPACK or * BLAS routine indicates that an internal error has occurred. * */ class scythe_lapack_internal_error:public scythe_exception { public: scythe_lapack_internal_error(const std::string& file, const std::string& function, const unsigned int& line, const std::string& message = "", const bool& halt = false) throw () : scythe_exception("SCYTHE LAPACK/BLAS INTERNAL ERROR", file, function, line, message, halt) {} }; /*! \brief Unexpected call to default error. * * This error should not occur. If it occurs in your code, please * contact the Scythe developers to report the problem. * */ class scythe_unexpected_default_error:public scythe_exception { public: scythe_unexpected_default_error(const std::string& file, const std::string& function, const unsigned int& line, const std::string& message = "", const bool& halt = false) throw () : scythe_exception("SCYTHE UNEXPECTED DEFAULT ERROR", file, function, line, message, halt) {} }; // The definition of our terminate handler described above inline void scythe_terminate () { std::cerr << serr->what() << std::endl; std::cerr << std::endl; abort (); }} // end namspace SCYTHE#endif /* SCYTHE_ERROR_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -