XACC
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 - 2020 Vlad Gheorghiu.
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 <istream>
63 #include <iterator>
64 #include <limits>
65 #include <list>
66 #include <map>
67 #include <memory>
68 #include <numeric>
69 #include <ostream>
70 #include <random>
71 #include <sstream>
72 #include <stdexcept>
73 #include <string>
74 #include <tuple>
75 #include <type_traits>
76 #include <unordered_map>
77 #include <utility>
78 #include <vector>
79 
80 // Eigen headers
81 #include <Eigen/Dense>
82 #include <Eigen/SVD>
83 
84 // Quantum++ headers
85 
86 // do not change the order in this group, inter-dependencies
87 #include "types.h"
88 #include "classes/exception.h"
89 #include "constants.h"
90 #include "traits.h"
91 #include "classes/idisplay.h"
92 #include "internal/util.h"
94 #include "input_output.h"
95 
96 // do not change the order in this group, inter-dependencies
98 #include "classes/random_devices.h"
99 #include "random.h"
100 #include "number_theory.h"
101 
102 // do not change the order in this group, inter-dependencies
103 #include "functions.h"
104 #include "classes/init.h"
105 #include "classes/codes.h"
106 #include "classes/gates.h"
107 #include "classes/states.h"
108 
109 // do not change the order in this group, inter-dependencies
110 #include "statistics.h"
111 #include "operations.h"
112 #include "entropies.h"
113 #include "entanglement.h"
114 
115 // the ones below can be in any order, no inter-dependencies
116 #include "instruments.h"
117 #include "classes/layouts.h"
118 #include "classes/noise.h"
119 #include "classes/reversible.h"
120 #include "classes/timer.h"
123 
124 // do not change the order in this group, inter-dependencies
125 #include "qasm/token.h"
126 #include "qasm/lexer.h"
127 #include "qasm/preprocessor.h"
128 #include "qasm/ast.h"
129 #include "qasm/parser.h"
130 #include "qasm/qasm.h"
131 
136 namespace qpp {
142 static const Init& init QPP_UNUSED_ = Init::get_instance();
143 
149 static const Codes& codes QPP_UNUSED_ = Codes::get_instance();
150 
156 static const Gates& gt QPP_UNUSED_ = Gates::get_instance();
157 
163 static const States& st QPP_UNUSED_ = States::get_instance();
164 
173 #ifdef NO_THREAD_LOCAL_
174 static RandomDevices& rdevs QPP_UNUSED_ = RandomDevices::get_instance();
175 #else
176 thread_local static RandomDevices& rdevs QPP_UNUSED_ =
177  RandomDevices::get_thread_local_instance();
178 #endif // NO_THREAD_LOCAL_
179 
180 } /* namespace qpp */
181 
182 #endif /* QPP_H_ */
openQASM to QCircuit interface
Singleton pattern via CRTP.
Type aliases.
Initialization.
Entanglement functions.
Constants.
Quantum++ main namespace.
Definition: circuits.h:35
Quantum operation functions.
Number theory functions.
Quantum states.
Qudit quantum circuits.
Type traits.
openQASM 2.0 AST
Various qudit placement layouts, all must implement the interface qpp::ILayout.
Timing.
Statistics functions.
openQASM 2.0 parsing
Exceptions.
Measurement functions.
Support for classical reversible circuits.
Input/output manipulators.
Lexical analysis for openQASM.
Input/output functions.
Entropy functions.
Internal utility functions.
Noise models.
Generic quantum computing functions.
Manages includes for openQASM parsing.
Random devices.
Quantum error correcting codes.
Randomness-related functions.
Quantum gates.
openQASM tokens
Display interface via the non-virtual interface (NVI) and very basic JSON serialization support inter...
Qudit quantum engines.