Quantum++  v1.0-rc3
A modern C++11 quantum computing library
qpp.h
Go to the documentation of this file.
1 /*
2  * This file is part of Quantum++.
3  *
4  * MIT License
5  *
6  * Copyright (c) 2013 - 2018 Vlad Gheorghiu (vgheorgh@gmail.com)
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24  * SOFTWARE.
25  */
26 
27 // IMPORTANT: instantiation of global singletons
28 // Init, Codes, Gates, States and RandomDevices
29 //
30 // Any additional singletons should be instantiated here
31 // Includes all necessary headers (except "matlab.h")
32 // ALWAYS include it in main.cpp
33 
39 #ifndef QPP_H_
40 #define QPP_H_
41 
42 // silence bogus warning -Wunused-variable for singletons
43 #if (__GNUC__ && !__clang__)
44 #define QPP_UNUSED_ __attribute__((unused))
45 #else
46 #define QPP_UNUSED_
47 #endif
48 
49 // standard C++ library headers
50 #include <algorithm>
51 #include <cassert>
52 #include <chrono>
53 #include <cmath>
54 #include <complex>
55 #include <cstdlib>
56 #include <cstring>
57 #include <exception>
58 #include <fstream>
59 #include <functional>
60 #include <initializer_list>
61 #include <iomanip>
62 #include <iterator>
63 #include <limits>
64 #include <memory>
65 #include <numeric>
66 #include <ostream>
67 #include <random>
68 #include <sstream>
69 #include <stdexcept>
70 #include <string>
71 #include <tuple>
72 #include <type_traits>
73 #include <utility>
74 #include <vector>
75 
76 // Eigen headers
77 #include <Eigen/Dense>
78 #include <Eigen/SVD>
79 
80 // Quantum++ headers
81 
82 // do not change the order in this group, inter-dependencies
83 #include "types.h"
84 #include "classes/exception.h"
85 #include "constants.h"
86 #include "traits.h"
87 #include "classes/idisplay.h"
88 #include "internal/util.h"
90 #include "input_output.h"
91 
92 // do not change the order in this group, inter-dependencies
94 #include "classes/init.h"
95 #include "functions.h"
96 #include "classes/codes.h"
97 #include "classes/gates.h"
98 #include "classes/states.h"
99 #include "classes/random_devices.h"
100 
101 // do not change the order in this group, inter-dependencies
102 #include "statistics.h"
103 #include "operations.h"
104 #include "entropies.h"
105 #include "entanglement.h"
106 
107 // the ones below can be in any order, no inter-dependencies
108 #include "random.h"
109 #include "classes/timer.h"
110 #include "instruments.h"
111 #include "number_theory.h"
112 
117 namespace qpp {
123 static const Init& init QPP_UNUSED_ = Init::get_instance();
124 
130 static const Codes& codes QPP_UNUSED_ = Codes::get_instance();
131 
137 static const Gates& gt QPP_UNUSED_ = Gates::get_instance();
138 
144 static const States& st QPP_UNUSED_ = States::get_instance();
145 
154 #ifdef NO_THREAD_LOCAL_
155 static RandomDevices& rdevs QPP_UNUSED_ = RandomDevices::get_instance();
156 #else
157 thread_local static RandomDevices& rdevs QPP_UNUSED_ =
159 #endif // NO_THREAD_LOCAL_
160 
161 } /* namespace qpp */
162 
163 #endif /* QPP_H_ */
Singleton pattern via CRTP.
Type aliases.
Initialization.
Entanglement functions.
Constants.
Quantum++ main namespace.
Definition: codes.h:35
Quantum operation functions.
Number theory functions.
Quantum states.
Type traits.
Timing.
Statistics functions.
Exceptions.
Measurement functions.
Input/output manipulators.
static RandomDevices & get_thread_local_instance() noexcept(std::is_nothrow_constructible< RandomDevices >::value)
Definition: singleton.h:103
Input/output functions.
Entropy functions.
Internal utility functions.
#define QPP_UNUSED_
Definition: qpp.h:46
Generic quantum computing functions.
Random devices.
static const Init & get_instance() noexcept(std::is_nothrow_constructible< const Init >::value)
Definition: singleton.h:92
Quantum error correcting codes.
Randomness-related functions.
Quantum gates.
Display interface via the non-virtual interface (NVI)