Quantum++
v1.0.0-beta2
C++11 quantum computing library
|
Generates custom exceptions, used when validating function parameters. More...
#include <classes/exception.h>
Public Member Functions | |
Exception (const std::string &where, const Type &type) | |
Constructs an exception. More... | |
Exception (const std::string &where, const std::string &custom) | |
Constructs an exception. More... | |
virtual const char * | what () const noexcept override |
Overrides std::exception::what() More... | |
Private Member Functions | |
void | construct_exception_msg_ () |
Constructs the exception description from its type. More... | |
Private Attributes | |
std::string | where_ |
std::string | msg_ |
Type | type_ |
std::string | custom_ |
Generates custom exceptions, used when validating function parameters.
Customize this class if more exceptions are needed
|
strong |
Exception types, add more here if needed.
Enumerator | |
---|---|
UNKNOWN_EXCEPTION |
Unknown exception |
ZERO_SIZE |
Zero sized object, e.g. empty Eigen::Matrix or std::vector with no elements |
MATRIX_NOT_SQUARE |
Eigen::Matrix is not square |
MATRIX_NOT_CVECTOR |
Eigen::Matrix is not a column vector |
MATRIX_NOT_RVECTOR |
Eigen::Matrix is not a row vector |
MATRIX_NOT_VECTOR |
Eigen::Matrix is not a row/column vector |
MATRIX_NOT_SQUARE_OR_CVECTOR |
Eigen::Matrix is not square nor a column vector |
MATRIX_NOT_SQUARE_OR_RVECTOR |
Eigen::Matrix is not square nor a row vector |
MATRIX_NOT_SQUARE_OR_VECTOR |
Eigen::Matrix is not square nor a row/column vector |
MATRIX_MISMATCH_SUBSYS |
Matrix size mismatch subsystem sizes (e.g. in qpp::apply()) |
DIMS_INVALID |
std::vector<idx> of dimensions has zero size or contains zeros |
DIMS_NOT_EQUAL |
Local/global dimensions are not equal |
DIMS_MISMATCH_MATRIX |
Product of the elements of std::vector<idx> of dimensions is not equal to the number of rows of Eigen::Matrix (assumed to be a square matrix) |
DIMS_MISMATCH_CVECTOR |
Product of the elements of std::vector<idx> of dimensions is not equal to the number of elements of Eigen::Matrix (assumed to be a column vector) |
DIMS_MISMATCH_RVECTOR |
Product of the elements of std::vector<idx> of dimensions is not equal to the number of elements of Eigen::Matrix (assumed to be a row vector) |
DIMS_MISMATCH_VECTOR |
Product of the elements of std::vector<idx> of dimensions is not equal to the number of elements of Eigen::Matrix (assumed to be a row/column vector) |
SUBSYS_MISMATCH_DIMS |
std::vector<idx> of subsystem labels has duplicates, or has entries that are larger than the size of the std::vector<idx> of dimensions |
PERM_INVALID |
std::vector<idx> does note represent a valid permutation |
PERM_MISMATCH_DIMS |
Size of the std::vector<idx> representing the permutation is different from the size of the std::vector<idx> of dimensions |
NOT_QUBIT_MATRIX |
Eigen::Matrix is not 2 x 2 |
NOT_QUBIT_CVECTOR |
Eigen::Matrix is not 2 x 1 |
NOT_QUBIT_RVECTOR |
Eigen::Matrix is not 1 x 2 |
NOT_QUBIT_VECTOR |
Eigen::Matrix is not 1 x 2 nor 2 x 1 |
NOT_QUBIT_SUBSYS |
Subsystems are not 2-dimensional |
NOT_BIPARTITE |
std::vector<idx> of dimensions has size different from 2 |
NO_CODEWORD |
Codeword does not exist, thrown when calling qpp::Codes::codeword() with invalid index i |
OUT_OF_RANGE |
Parameter out of range |
TYPE_MISMATCH |
Scalar types do not match |
SIZE_MISMATCH |
Sizes do not match |
UNDEFINED_TYPE |
Templated specialization not defined for this type |
CUSTOM_EXCEPTION |
Custom exception, the user must provide a custom message |
|
inline |
Constructs an exception.
where | Text representing where the exception occured |
type | Exception type, defined in qpp::Exception::Type |
|
inline |
Constructs an exception.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
where | Text representing where the exception occured |
custom | Exception description |
|
inlineprivate |
Constructs the exception description from its type.
Must modify the code of this function if more exceptions are added
|
inlineoverridevirtualnoexcept |
Overrides std::exception::what()
|
private |
|
private |
|
private |
|
private |