mixmod  3.2.0
Mixture models for clustering and classification
 All Classes Namespaces Files Functions Variables Enumerations Friends
NumericException.h
1 /***************************************************************************
2  SRC/mixmod/Utilities/exceptions/NumericException.h description
3  copyright : (C) MIXMOD Team - 2001-2016
4  email : contact@mixmod.org
5  ***************************************************************************/
6 
7 /***************************************************************************
8  This file is part of MIXMOD
9 
10  MIXMOD is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MIXMOD is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with MIXMOD. If not, see <http://www.gnu.org/licenses/>.
22 
23  All informations available on : http://www.mixmod.org
24 ***************************************************************************/
30 #ifndef XEM_NUMERICEXCEPTION_H
31 #define XEM_NUMERICEXCEPTION_H
32 
33 #include "mixmod/Utilities/exceptions/Exception.h"
34 
35 namespace XEM {
36 
37 class NumericException : public Exception {
38 
39 public:
40 
41  NumericException(std::string, int, NumericError) throw ();
42  NumericException(NumericError) throw ();
43  Exception * clone() throw ();
44  virtual const char* what() const throw ();
45  virtual bool operator==(const Exception&) const throw ();
46  virtual void run(std::ostream & flux = std::cout) const throw ();
47 
48  virtual ~NumericException() throw () {
49  }
50 
51  static std::map<NumericError, const char*> create_map()
52  {
53  std::map<NumericError, const char*> m;
54 
55  m.insert(std::make_pair(int64_t_max_error, "int64_t limits reached"));
56  m.insert(std::make_pair(CEM_INIT_error, "Error : error in CEM_INIT initialization : in all tries occurs an error"));
57  m.insert(std::make_pair(SEM_MAX_error, "Error : error in SEM_MAX initialization : in all tries occurs an error"));
58  m.insert(std::make_pair(SMALL_EM_error, "Error : error in SMALL_EM initialization : in all tries occurs an error"));
59  m.insert(std::make_pair(tabNkNotInteger, "tabNk is not an integer"));
60  m.insert(std::make_pair(sumFiNullAndfkTPrimNull, "SumF[i]=0 in multinomial case"));
61  m.insert(std::make_pair(sumFiNullInMultinomialCase, "SumF[i]=0 in multinomial case. Please report this bug to Mixmod team !"));
62  m.insert(std::make_pair(nonPositiveDefiniteMatrix,"Variance matrix is non positive definite"));
63  m.insert(std::make_pair(nullDeterminant, "Matrix determinant null"));
64  m.insert(std::make_pair(randomProblem, "Problem in Random function call"));
65  m.insert(std::make_pair(nullLikelihood, "Null likelihood"));
66  m.insert(std::make_pair(noProbability, "Probability (cf. NormPdf function) not between 0 and 1"));
67  m.insert(std::make_pair(pbNEC, "NEC criterion, the difference between log-likelihood for k and 1 cluster is null"));
68  m.insert(std::make_pair(nullNk, "Empty mixture component"));
69  m.insert(std::make_pair(numericError, "A numeric error occured"));
70  m.insert(std::make_pair(errorSigmaConditionNumber, "error in variance matrix condition number"));
71  m.insert(std::make_pair(minDeterminantSigmaValueError, "determinant of matrix too small"));
72  m.insert(std::make_pair(minDeterminantWValueError, "determinant of matrix too small"));
73  m.insert(std::make_pair(minDeterminantDiagWkValueError, "determinant of matrix too small"));
74  m.insert(std::make_pair(minDeterminantDiagWValueError, "determinant of matrix too small"));
75  m.insert(std::make_pair(minDeterminantBValueError, "determinant of matrix too small"));
76  m.insert(std::make_pair(minDeterminantRValueError, "determinant of matrix too small"));
77  m.insert(std::make_pair(minDeterminantWkValueError, "determinant of matrix too small"));
78  m.insert(std::make_pair(minDeterminantShapeValueError, "determinant of matrix too small"));
79  m.insert(std::make_pair(minDeterminantDiagQtmpValueError, "determinant of matrix too small"));
80 
81  return m;
82  }
83 
84  static std::map<NumericError, const char*> mapErrorMsg;
85 
86 protected:
87 
88  NumericError _errorType;
89 };
90 
91 }
92 
93 #endif /* XEMNUMERICEXCEPTION_H_ */
Definition: Exception.h:42
virtual void run(std::ostream &flux=std::cout) const
Definition: NumericException.cpp:58
Definition: NumericException.h:37
virtual bool operator==(const Exception &) const
Definition: NumericException.cpp:52
virtual const char * what() const
Definition: NumericException.cpp:48