-
Notifications
You must be signed in to change notification settings - Fork 132
3. Data types, constants and global objects
Vlad Gheorghiu edited this page Jan 17, 2018
·
10 revisions
All header files of Quantum++ are
located inside the qpp/include
directory.
All functions, classes and global objects defined by the library belong to the namespace qpp
.
To avoid additional typing, I will omit the prefix qpp::
in the rest of
this document.
The most important data types are defined in the header file types.h
.
We list them in the table below.
Type | Description |
---|---|
idx |
Index (non-negative integer), alias for std::size_t
|
bigint |
Big integer, alias for long long int
|
cplx |
Complex number, alias for std::complex<double>
|
cmat |
Complex dynamic matrix, alias for Eigen::MatrixXcd
|
dmat |
Double dynamic matrix, alias for Eigen::MatrixXd
|
ket |
Complex dynamic column vector, alias for Eigen::VectorXcd
|
bra |
Complex dynamic row vector, alias for Eigen::RowVectorXcd
|
dyn_mat<Scalar> |
Dynamic matrix template alias over the field Scalar , alias for Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>
|
dyn_col_vect<Scalar> |
Dynamic column vector template alias over the field Scalar , alias for Eigen::Matrix<Scalar, Eigen::Dynamic, 1>
|
dyn_row_vect<Scalar> |
Dynamic row vector template alias over the field Scalar , alias for Eigen::Matrix<Scalar, 1, Eigen::Dynamic>
|
The important constants are defined in the header file constants.h
and
are listed in Table [tbl2].
Constant | Description |
---|---|
constexpr idx maxn = 64; |
Maximum number of allowed qu(d)its (subsystems) |
constexpr double pi = 3.1415...; |
|
constexpr double ee = 2.7182...; |
|
constexpr double eps = 1e-12; |
Used in comparing floating point values to zero |
constexpr double chop = 1e-10; |
Used in display manipulators to set numbers to zero |
constexpr double infty = ...; |
Used to denote infinity in double precision |
constexpr cplx operator""_i (unsigned long long int x)
|
User-defined literal for the imaginary number |
constexpr cplx operator""_i (unsigned long double int x)
|
User-defined literal for the imaginary number |
cplx omega(idx D) |
|
Some useful classes are defined as singletons and their instances are
globally available, being initialized at runtime in the header file
qpp.h
, before main()
. They are listed in Table [tbl3].
Singleton | Description |
---|---|
const Init& init = Init::get_instance(); |
Library initialization |
const Codes& codes = Codes::get_instance(); |
Quantum error correcting codes |
const Gates& gt = Gates::get_instance(); |
Quantum gates |
const States& st = States::get_instance(); |
Quantum states |
RandomDevices& rdevs = RandomDevices::get_thread_local_instance();
|
Random devices/generators/engines |
Copyright (c) 2017 - 2025 softwareQ Inc. All rights reserved.