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 ";
Type type_
Definition: exception.h:165
std::string custom_
Definition: exception.h:166
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
Generates custom exceptions, used when validating function parameters.
Definition: exception.h:39
std::string msg_
Definition: exception.h:164
Exception(const std::string &where, const Type &type)
Constructs an exception.
Definition: exception.h:131
virtual const char * what() const noexcept override
Overrides std::exception::what()
Definition: exception.h:158
void construct_exception_msg_()
Constructs the exception description from its type.
Definition: exception.h:174