27 #ifndef CLASSES_EXCEPTION_H_
28 #define CLASSES_EXCEPTION_H_
130 _where{where}, _msg{}, _type{type}, _custom{}
132 _construct_exception_msg();
143 Exception(
const std::string& where,
const std::string& custom) :
147 _construct_exception_msg();
156 virtual const char*
what() const noexcept
override
162 std::string _where, _msg;
172 void _construct_exception_msg()
181 _msg +=
"UNKNOWN EXCEPTION!";
184 _msg +=
"Object has zero size!";
187 _msg +=
"Matrix is not square!";
190 _msg +=
"Matrix is not column vector!";
193 _msg +=
"Matrix is not row vector!";
196 _msg +=
"Matrix is not vector!";
199 _msg +=
"Matrix is not square nor column vector!";
202 _msg +=
"Matrix is not square nor row vector!";
205 _msg +=
"Matrix is not square nor vector!";
208 _msg +=
"Matrix mismatch subsystems!";
211 _msg +=
"Invalid dimension(s)!";
214 _msg +=
"Dimensions not equal!";
217 _msg +=
"Dimension(s) mismatch matrix size!";
220 _msg +=
"Dimension(s) mismatch column vector!";
223 _msg +=
"Dimension(s) mismatch row vector!";
226 _msg +=
"Dimension(s) mismatch vector!";
229 _msg +=
"Subsystems mismatch dimensions!";
232 _msg +=
"Invalid permutation!";
235 _msg +=
"Permutation mismatch dimensions!";
238 _msg +=
"Matrix is not 2 x 2!";
241 _msg +=
"Column vector is not 2 x 1!";
244 _msg +=
"Row vector is not 1 x 2!";
247 _msg +=
"Vector is not 2 x 1 nor 1 x 2!";
250 _msg +=
"Subsystems are not qubits!";
253 _msg +=
"Not bi-partite!";
256 _msg +=
"Codeword does not exist!";
259 _msg +=
"Parameter out of range!";
262 _msg +=
"Type mismatch!";
265 _msg +=
"Not defined for this type!";
268 _msg +=
"CUSTOM EXCEPTION ";
virtual const char * what() const noexceptoverride
Overrides std::exception::what()
Definition: exception.h:156
Quantum++ main namespace.
Definition: codes.h:30
Exception(const std::string &where, const std::string &custom)
Constructs an exception.
Definition: exception.h:143
Type
Exception types, add more here if needed.
Definition: exception.h:46
Generates custom exceptions, used when validating function parameters.
Definition: exception.h:39
Exception(const std::string &where, const Type &type)
Constructs an exception.
Definition: exception.h:129