-
Notifications
You must be signed in to change notification settings - Fork 120
3. Data types, constants and global objects
Vlad Gheorghiu edited this page Apr 5, 2024
·
9 revisions
All header files of Quantum++ are
located inside the
include
directory.
All functions, classes and global objects defined by the library belong to the
namespace qpp
. To avoid additional typing, we will omit the prefix qpp::
in
the rest of this document.
The most important data types are defined in the header file
types.hpp
.
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
|
rmat |
Real (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>
|
qram |
Quantumly-accessible Random Access Memory (qRAM), alias for std::vector<idx>
|
dirac_t |
Textual representation (Dirac notation) of a quantum state/matrix |
The important constants are defined in the header file constants.hpp
and are
listed in below.
Constant | Description |
---|---|
constexpr double pi = 3.1415...; |
|
constexpr double ee = 2.7182...; |
|
constexpr double chop = 1e-14; |
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 below.
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 - 2024 softwareQ Inc. All rights reserved.