Quandary
Loading...
Searching...
No Matches
Macros | Enumerations | Variables
defs.hpp File Reference

Core type definitions and enumerations for Quandary quantum optimal control. More...

#include <map>
#include <optional>
#include <string>
#include <vector>
Include dependency graph for defs.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define M_PI   3.14159265358979323846
 
#define SQR(x)   (x)*(x)
 

Enumerations

enum class  DecoherenceType { NONE , DECAY , DEPHASE , BOTH }
 Available Lindblad operator types for open quantum systems, or NONE for closed quantum systems. More...
 
enum class  InitialConditionType {
  FROMFILE , PRODUCT_STATE , ENSEMBLE , DIAGONAL ,
  BASIS , THREESTATES , NPLUSONE , PERFORMANCE
}
 Available types of initial conditions that are propagated through the quantum dynamics. More...
 
enum class  TargetType { NONE , GATE , STATE }
 Types of optimization targets for quantum control. More...
 
enum class  ObjectiveType { JFROBENIUS , JTRACE , JMEASURE }
 Types of objective functions for quantum control optimization. More...
 
enum class  LinearSolverType { GMRES , NEUMANN }
 Available types for solving linear systems at each time step. More...
 
enum class  RunType {
  SIMULATION , GRADIENT , OPTIMIZATION , EVALCONTROLS ,
  NONE
}
 Types of execution modes. More...
 
enum class  ControlType { NONE , BSPLINE , BSPLINEAMP , BSPLINE0 }
 Types of control parameterizations. More...
 
enum class  ControlInitializationType { CONSTANT , RANDOM , FILE }
 Types of control initializations. More...
 
enum class  TimeStepperType { IMR , IMR4 , IMR8 , EE }
 Types of time-stepping methods for evolving quantum states. More...
 
enum class  GateType {
  NONE , XGATE , YGATE , ZGATE ,
  HADAMARD , CNOT , SWAP , SWAP_0Q ,
  CQNOT , QFT , FILE
}
 Types of quantum gates used in quantum control. More...
 
enum class  OutputType {
  EXPECTED_ENERGY , EXPECTED_ENERGY_COMPOSITE , POPULATION , POPULATION_COMPOSITE ,
  FULLSTATE
}
 Types of output files to be written. More...
 

Variables

const std::map< std::string, DecoherenceTypeDECOHERENCE_TYPE_MAP
 
const std::map< std::string, InitialConditionTypeINITCOND_TYPE_MAP
 
const std::map< std::string, TargetTypeTARGET_TYPE_MAP
 
const std::map< std::string, ObjectiveTypeOBJECTIVE_TYPE_MAP
 
const std::map< std::string, LinearSolverTypeLINEAR_SOLVER_TYPE_MAP
 
const std::map< std::string, RunTypeRUN_TYPE_MAP
 
const std::map< std::string, ControlTypeCONTROL_TYPE_MAP
 
const std::map< std::string, ControlInitializationTypeCONTROL_INITIALIZATION_TYPE_MAP
 
const std::map< std::string, TimeStepperTypeTIME_STEPPER_TYPE_MAP
 
const std::map< std::string, GateTypeGATE_TYPE_MAP
 
const std::map< std::string, OutputTypeOUTPUT_TYPE_MAP
 

Detailed Description

Core type definitions and enumerations for Quandary quantum optimal control.

This file contains fundamental type definitions, enumeration classes, and constants used throughout the Quandary quantum optimal control framework. It defines solver types, target specifications, objective functions, and control parameterizations.

Macro Definition Documentation

◆ M_PI

#define M_PI   3.14159265358979323846

◆ SQR

#define SQR (   x)    (x)*(x)

Enumeration Type Documentation

◆ ControlInitializationType

enum class ControlInitializationType
strong

Types of control initializations.

Enumerator
CONSTANT 

Constant.

RANDOM 

Random.

FILE 

From file.

◆ ControlType

enum class ControlType
strong

Types of control parameterizations.

Defines how control pulses are parameterized for optimization and simulation.

Enumerator
NONE 

Non-controllable.

BSPLINE 

Control pulses are parameterized with 2nd order BSpline basis functions with carrier waves.

BSPLINEAMP 

Paramerizes only the amplitudes of the control pulse with 2nd order BSpline basis functions.

BSPLINE0 

Control pulses are parameterized with Zeroth order Bspline (piece-wise constant)

◆ DecoherenceType

enum class DecoherenceType
strong

Available Lindblad operator types for open quantum systems, or NONE for closed quantum systems.

For open quantum systems, this defines the types of dissipation and decoherence operators that can be applied to the quantum system in Lindblad master equation.

Note
If this is NONE, the quantum system is considered closed, solving Schroedinger's equation rather than Lindblad's master equation.
Enumerator
NONE 

No Lindblad operators (closed system)

DECAY 

Decay operators only.

DEPHASE 

Dephasing operators only.

BOTH 

Both decay and dephasing operators.

◆ GateType

enum class GateType
strong

Types of quantum gates used in quantum control.

Enumerator
NONE 

No gate.

XGATE 

X gate (Pauli-X)

YGATE 

Y gate (Pauli-Y)

ZGATE 

Z gate (Pauli-Z)

HADAMARD 

Hadamard gate.

CNOT 

CNOT gate.

SWAP 

SWAP gate.

SWAP_0Q 

Multi-qubit SWAP gate with 0 qubit.

CQNOT 

Multi-qubit CQNOT gate.

QFT 

QFT gate.

FILE 

Gate defined in a file.

◆ InitialConditionType

enum class InitialConditionType
strong

Available types of initial conditions that are propagated through the quantum dynamics.

Defines how the initial quantum state is specified and prepared for simulation or optimization.

Enumerator
FROMFILE 

Read initial condition from file.

PRODUCT_STATE 

Product state initial condition.

ENSEMBLE 

Ensemble of states.

DIAGONAL 

Diagonal density matrix.

BASIS 

Basis state.

THREESTATES 

Three-state system.

NPLUSONE 

N+1 state system.

PERFORMANCE 

Performance test configuration.

◆ LinearSolverType

enum class LinearSolverType
strong

Available types for solving linear systems at each time step.

Defines the numerical methods used to solve linear systems arising in quantum dynamics simulations at each time step.

Enumerator
GMRES 

Uses Petsc's GMRES solver (default)

NEUMANN 

Uses Neuman power iterations.

◆ ObjectiveType

enum class ObjectiveType
strong

Types of objective functions for quantum control optimization.

Defines different metrics for measuring the quality of quantum control.

Enumerator
JFROBENIUS 

Weighted Frobenius norm: \(\frac{1}{2} \frac{\|\rho_{\text{target}} - \rho(T)\|_F^2}{w}\), where \(w\) = purity of \(\rho_{\text{target}}\).

JTRACE 

Weighted Hilbert-Schmidt overlap: \(1 - \frac{\text{Tr}(\rho_{\text{target}}^\dagger \rho(T))}{w}\), where \(w\) = purity of \(\rho_{\text{target}}\).

JMEASURE 

Pure state measurement: \(\text{Tr}(O_m \rho(T))\) for observable \(O_m\).

◆ OutputType

enum class OutputType
strong

Types of output files to be written.

Enumerator
EXPECTED_ENERGY 

Expected energy.

EXPECTED_ENERGY_COMPOSITE 

Expected energy composite.

POPULATION 

Population.

POPULATION_COMPOSITE 

Population composite.

FULLSTATE 

Full state.

◆ RunType

enum class RunType
strong

Types of execution modes.

Defines what type of computation should be performed.

Enumerator
SIMULATION 

Runs one simulation to compute the objective function (forward)

GRADIENT 

Runs a simulation followed by the adjoint for gradient computation (forward & backward)

OPTIMIZATION 

Runs optimization iterations.

EVALCONTROLS 

Only evaluates the current control pulses (no simulation)

NONE 

Don't run anything.

◆ TargetType

enum class TargetType
strong

Types of optimization targets for quantum control.

Defines the target quantum state or operation for optimization.

Enumerator
NONE 

No target specified (no optimization)

GATE 

Gate optimization: \(\rho_{\text{target}} = V\rho(0) V^\dagger\) for V either read from file or chosen from default set of gates.

STATE 

State preparation: Either read from file, or \(\rho_{\text{target}} = e_m e_m^\dagger\) for some integer \(m\).

◆ TimeStepperType

enum class TimeStepperType
strong

Types of time-stepping methods for evolving quantum states.

Defines the numerical methods used to evolve quantum states in time.

Enumerator
IMR 

Implicit Midpoint Rule (2nd order)

IMR4 

Implicit Midpoint Rule with 4th order extrapolation.

IMR8 

Implicit Midpoint Rule with 8th order extrapolation.

EE 

Explicit Euler (1st order)

Variable Documentation

◆ CONTROL_INITIALIZATION_TYPE_MAP

const std::map<std::string, ControlInitializationType> CONTROL_INITIALIZATION_TYPE_MAP

◆ CONTROL_TYPE_MAP

const std::map<std::string, ControlType> CONTROL_TYPE_MAP
Initial value:
= {
{"none", ControlType::NONE},
{"spline", ControlType::BSPLINE},
{"spline_amplitude", ControlType::BSPLINEAMP},
{"spline0", ControlType::BSPLINE0}
}
@ 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.

◆ DECOHERENCE_TYPE_MAP

const std::map<std::string, DecoherenceType> DECOHERENCE_TYPE_MAP
Initial value:
= {
}
@ BOTH
Both decay and dephasing operators.
@ DEPHASE
Dephasing operators only.
@ NONE
No Lindblad operators (closed system)
@ DECAY
Decay operators only.

◆ GATE_TYPE_MAP

const std::map<std::string, GateType> GATE_TYPE_MAP
Initial value:
= {
{"none", GateType::NONE},
{"xgate", GateType::XGATE},
{"ygate", GateType::YGATE},
{"zgate", GateType::ZGATE},
{"hadamard", GateType::HADAMARD},
{"cnot", GateType::CNOT},
{"swap", GateType::SWAP},
{"swap0q", GateType::SWAP_0Q},
{"cqnot", GateType::CQNOT},
{"qft", GateType::QFT},
{"file", GateType::FILE}
}
@ 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)

◆ INITCOND_TYPE_MAP

const std::map<std::string, InitialConditionType> INITCOND_TYPE_MAP
Initial value:
= {
}
@ 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.

◆ LINEAR_SOLVER_TYPE_MAP

const std::map<std::string, LinearSolverType> LINEAR_SOLVER_TYPE_MAP
Initial value:
= {
}
@ NEUMANN
Uses Neuman power iterations.
@ GMRES
Uses Petsc's GMRES solver (default)

◆ OBJECTIVE_TYPE_MAP

const std::map<std::string, ObjectiveType> OBJECTIVE_TYPE_MAP
Initial value:
= {
{"jfrobenius", ObjectiveType::JFROBENIUS},
{"jtrace", ObjectiveType::JTRACE},
}
@ JMEASURE
Pure state measurement: for observable .
@ JFROBENIUS
Weighted Frobenius norm: , where = purity of .
@ JTRACE
Weighted Hilbert-Schmidt overlap: , where = purity of .

◆ OUTPUT_TYPE_MAP

const std::map<std::string, OutputType> OUTPUT_TYPE_MAP
Initial value:
= {
{"expectedenergy", OutputType::EXPECTED_ENERGY},
{"expectedenergycomposite", OutputType::EXPECTED_ENERGY_COMPOSITE},
{"population", OutputType::POPULATION},
{"populationcomposite", OutputType::POPULATION_COMPOSITE},
{"fullstate", OutputType::FULLSTATE},
}
@ POPULATION
Population.
@ EXPECTED_ENERGY_COMPOSITE
Expected energy composite.
@ POPULATION_COMPOSITE
Population composite.
@ FULLSTATE
Full state.
@ EXPECTED_ENERGY
Expected energy.

◆ RUN_TYPE_MAP

const std::map<std::string, RunType> RUN_TYPE_MAP
Initial value:
= {
{"simulation", RunType::SIMULATION},
{"gradient", RunType::GRADIENT},
{"optimization", RunType::OPTIMIZATION},
{"evalcontrols", RunType::EVALCONTROLS},
{"none", RunType::NONE}
}
@ 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)

◆ TARGET_TYPE_MAP

const std::map<std::string, TargetType> TARGET_TYPE_MAP
Initial value:
= {
{"none", TargetType::NONE},
{"gate", TargetType::GATE},
{"state", TargetType::STATE},
}
@ 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)

◆ TIME_STEPPER_TYPE_MAP

const std::map<std::string, TimeStepperType> TIME_STEPPER_TYPE_MAP
Initial value:
= {
}
@ 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.