Quandary
Loading...
Searching...
No Matches
defs.hpp
Go to the documentation of this file.
1#include <map>
2#include <optional>
3#include <string>
4#include <vector>
5
15#ifndef M_PI
16#define M_PI 3.14159265358979323846
17#endif
18#define SQR(x) (x)*(x)
19
20#pragma once
21
31enum class DecoherenceType {
32 NONE,
33 DECAY,
34 DEPHASE,
35 BOTH
36};
37
38const std::map<std::string, DecoherenceType> DECOHERENCE_TYPE_MAP = {
39 {"none", DecoherenceType::NONE},
40 {"decay", DecoherenceType::DECAY},
41 {"dephase", DecoherenceType::DEPHASE},
42 {"both", DecoherenceType::BOTH}
43};
44
61
62const std::map<std::string, InitialConditionType> INITCOND_TYPE_MAP = {
71};
72
78enum class TargetType {
79 NONE,
80 GATE,
81 STATE,
82};
83
84const std::map<std::string, TargetType> TARGET_TYPE_MAP = {
85 {"none", TargetType::NONE},
86 {"gate", TargetType::GATE},
87 {"state", TargetType::STATE},
88};
89
95enum class ObjectiveType {
97 JTRACE,
99};
100
101const std::map<std::string, ObjectiveType> OBJECTIVE_TYPE_MAP = {
102 {"jfrobenius", ObjectiveType::JFROBENIUS},
103 {"jtrace", ObjectiveType::JTRACE},
104 {"jmeasure", ObjectiveType::JMEASURE}
105};
106
114 GMRES,
115 NEUMANN
116};
117
118const std::map<std::string, LinearSolverType> LINEAR_SOLVER_TYPE_MAP = {
119 {"gmres", LinearSolverType::GMRES},
120 {"neumann", LinearSolverType::NEUMANN}
121};
122
128enum class RunType {
129 SIMULATION,
130 GRADIENT,
133 NONE
134};
135
136const std::map<std::string, RunType> RUN_TYPE_MAP = {
137 {"simulation", RunType::SIMULATION},
138 {"gradient", RunType::GRADIENT},
139 {"optimization", RunType::OPTIMIZATION},
140 {"evalcontrols", RunType::EVALCONTROLS},
141 {"none", RunType::NONE}
142};
143
149enum class ControlType {
150 NONE,
151 BSPLINE,
152 BSPLINEAMP,
153 BSPLINE0
154};
155
156const std::map<std::string, ControlType> CONTROL_TYPE_MAP = {
157 {"none", ControlType::NONE},
158 {"spline", ControlType::BSPLINE},
159 {"spline_amplitude", ControlType::BSPLINEAMP},
160 {"spline0", ControlType::BSPLINE0}
161};
162
167 CONSTANT,
168 RANDOM,
169 FILE,
170};
171
172const std::map<std::string, ControlInitializationType> CONTROL_INITIALIZATION_TYPE_MAP = {
176};
177
183enum class TimeStepperType {
184 IMR,
185 IMR4,
186 IMR8,
187 EE,
188};
189
190const std::map<std::string, TimeStepperType> TIME_STEPPER_TYPE_MAP = {
191 {"imr", TimeStepperType::IMR},
192 {"imr4", TimeStepperType::IMR4},
193 {"imr8", TimeStepperType::IMR8},
194 {"ee", TimeStepperType::EE}
195};
196
200enum class GateType {
201 NONE,
202 XGATE,
203 YGATE,
204 ZGATE,
205 HADAMARD,
206 CNOT,
207 SWAP,
208 SWAP_0Q,
209 CQNOT,
210 QFT,
211 FILE,
212};
213
214const std::map<std::string, GateType> GATE_TYPE_MAP = {
215 {"none", GateType::NONE},
216 {"xgate", GateType::XGATE},
217 {"ygate", GateType::YGATE},
218 {"zgate", GateType::ZGATE},
219 {"hadamard", GateType::HADAMARD},
220 {"cnot", GateType::CNOT},
221 {"swap", GateType::SWAP},
222 {"swap0q", GateType::SWAP_0Q},
223 {"cqnot", GateType::CQNOT},
224 {"qft", GateType::QFT},
225 {"file", GateType::FILE}
226};
227
238
239const std::map<std::string, OutputType> OUTPUT_TYPE_MAP = {
240 {"expectedenergy", OutputType::EXPECTED_ENERGY},
241 {"expectedenergycomposite", OutputType::EXPECTED_ENERGY_COMPOSITE},
242 {"population", OutputType::POPULATION},
243 {"populationcomposite", OutputType::POPULATION_COMPOSITE},
244 {"fullstate", OutputType::FULLSTATE},
245};
TargetType
Types of optimization targets for quantum control.
Definition defs.hpp:78
@ GATE
Gate optimization: for V either read from file or chosen from default set of gates.
@ STATE
State preparation: Either read from file, or for some integer .
@ NONE
No target specified (no optimization)
RunType
Types of execution modes.
Definition defs.hpp:128
@ SIMULATION
Runs one simulation to compute the objective function (forward)
@ GRADIENT
Runs a simulation followed by the adjoint for gradient computation (forward & backward)
@ NONE
Don't run anything.
@ OPTIMIZATION
Runs optimization iterations.
@ EVALCONTROLS
Only evaluates the current control pulses (no simulation)
DecoherenceType
Available Lindblad operator types for open quantum systems, or NONE for closed quantum systems.
Definition defs.hpp:31
@ BOTH
Both decay and dephasing operators.
@ DEPHASE
Dephasing operators only.
@ NONE
No Lindblad operators (closed system)
@ DECAY
Decay operators only.
const std::map< std::string, OutputType > OUTPUT_TYPE_MAP
Definition defs.hpp:239
ObjectiveType
Types of objective functions for quantum control optimization.
Definition defs.hpp:95
@ JMEASURE
Pure state measurement: for observable .
@ JFROBENIUS
Weighted Frobenius norm: , where = purity of .
@ JTRACE
Weighted Hilbert-Schmidt overlap: , where = purity of .
OutputType
Types of output files to be written.
Definition defs.hpp:231
@ POPULATION
Population.
@ EXPECTED_ENERGY_COMPOSITE
Expected energy composite.
@ POPULATION_COMPOSITE
Population composite.
@ FULLSTATE
Full state.
@ EXPECTED_ENERGY
Expected energy.
const std::map< std::string, GateType > GATE_TYPE_MAP
Definition defs.hpp:214
ControlType
Types of control parameterizations.
Definition defs.hpp:149
@ BSPLINE
Control pulses are parameterized with 2nd order BSpline basis functions with carrier waves.
@ BSPLINE0
Control pulses are parameterized with Zeroth order Bspline (piece-wise constant)
@ NONE
Non-controllable.
@ BSPLINEAMP
Paramerizes only the amplitudes of the control pulse with 2nd order BSpline basis functions.
InitialConditionType
Available types of initial conditions that are propagated through the quantum dynamics.
Definition defs.hpp:51
@ PERFORMANCE
Performance test configuration.
@ THREESTATES
Three-state system.
@ ENSEMBLE
Ensemble of states.
@ FROMFILE
Read initial condition from file.
@ NPLUSONE
N+1 state system.
@ PRODUCT_STATE
Product state initial condition.
@ DIAGONAL
Diagonal density matrix.
@ BASIS
Basis state.
GateType
Types of quantum gates used in quantum control.
Definition defs.hpp:200
@ YGATE
Y gate (Pauli-Y)
@ ZGATE
Z gate (Pauli-Z)
@ CQNOT
Multi-qubit CQNOT gate.
@ CNOT
CNOT gate.
@ SWAP
SWAP gate.
@ SWAP_0Q
Multi-qubit SWAP gate with 0 qubit.
@ FILE
Gate defined in a file.
@ HADAMARD
Hadamard gate.
@ NONE
No gate.
@ QFT
QFT gate.
@ XGATE
X gate (Pauli-X)
const std::map< std::string, InitialConditionType > INITCOND_TYPE_MAP
Definition defs.hpp:62
ControlInitializationType
Types of control initializations.
Definition defs.hpp:166
const std::map< std::string, DecoherenceType > DECOHERENCE_TYPE_MAP
Definition defs.hpp:38
TimeStepperType
Types of time-stepping methods for evolving quantum states.
Definition defs.hpp:183
@ IMR4
Implicit Midpoint Rule with 4th order extrapolation.
@ IMR
Implicit Midpoint Rule (2nd order)
@ EE
Explicit Euler (1st order)
@ IMR8
Implicit Midpoint Rule with 8th order extrapolation.
const std::map< std::string, TimeStepperType > TIME_STEPPER_TYPE_MAP
Definition defs.hpp:190
LinearSolverType
Available types for solving linear systems at each time step.
Definition defs.hpp:113
@ NEUMANN
Uses Neuman power iterations.
@ GMRES
Uses Petsc's GMRES solver (default)
const std::map< std::string, TargetType > TARGET_TYPE_MAP
Definition defs.hpp:84
const std::map< std::string, ControlType > CONTROL_TYPE_MAP
Definition defs.hpp:156
const std::map< std::string, ObjectiveType > OBJECTIVE_TYPE_MAP
Definition defs.hpp:101
const std::map< std::string, RunType > RUN_TYPE_MAP
Definition defs.hpp:136
const std::map< std::string, ControlInitializationType > CONTROL_INITIALIZATION_TYPE_MAP
Definition defs.hpp:172
const std::map< std::string, LinearSolverType > LINEAR_SOLVER_TYPE_MAP
Definition defs.hpp:118