27 #ifndef CLASSES_EXCEPTION_H_
28 #define CLASSES_EXCEPTION_H_
145 Exception(
const std::string& where,
const std::string& custom) :
158 virtual const char*
what() const noexcept
override
183 _msg +=
"UNKNOWN EXCEPTION!";
186 _msg +=
"Object has zero size!";
189 _msg +=
"Matrix is not square!";
192 _msg +=
"Matrix is not column vector!";
195 _msg +=
"Matrix is not row vector!";
198 _msg +=
"Matrix is not vector!";
201 _msg +=
"Matrix is not square nor column vector!";
204 _msg +=
"Matrix is not square nor row vector!";
207 _msg +=
"Matrix is not square nor vector!";
210 _msg +=
"Matrix mismatch subsystems!";
213 _msg +=
"Invalid dimension(s)!";
216 _msg +=
"Dimensions not equal!";
219 _msg +=
"Dimension(s) mismatch matrix size!";
222 _msg +=
"Dimension(s) mismatch column vector!";
225 _msg +=
"Dimension(s) mismatch row vector!";
228 _msg +=
"Dimension(s) mismatch vector!";
231 _msg +=
"Subsystems mismatch dimensions!";
234 _msg +=
"Invalid permutation!";
237 _msg +=
"Permutation mismatch dimensions!";
240 _msg +=
"Matrix is not 2 x 2!";
243 _msg +=
"Column vector is not 2 x 1!";
246 _msg +=
"Row vector is not 1 x 2!";
249 _msg +=
"Vector is not 2 x 1 nor 1 x 2!";
252 _msg +=
"Subsystems are not qubits!";
255 _msg +=
"Not bi-partite!";
258 _msg +=
"Codeword does not exist!";
261 _msg +=
"Parameter out of range!";
264 _msg +=
"Type mismatch!";
267 _msg +=
"Size mismatch!";
270 _msg +=
"Not defined for this type!";
273 _msg +=
"CUSTOM EXCEPTION ";
std::string _custom
Definition: exception.h:166
virtual const char * what() const noexceptoverride
Overrides std::exception::what()
Definition: exception.h:158
Quantum++ main namespace.
Definition: codes.h:30
Exception(const std::string &where, const std::string &custom)
Constructs an exception.
Definition: exception.h:145
Type
Exception types, add more here if needed.
Definition: exception.h:46
std::string _where
Definition: exception.h:164
Type _type
Definition: exception.h:165
std::string _msg
Definition: exception.h:164
Generates custom exceptions, used when validating function parameters.
Definition: exception.h:39
void _construct_exception_msg()
Constructs the exception description from its type.
Definition: exception.h:174
Exception(const std::string &where, const Type &type)
Constructs an exception.
Definition: exception.h:131