Quandary
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Gate Class Reference

Base class for quantum gate operations. More...

#include <gate.hpp>

Inheritance diagram for Gate:
Inheritance graph
[legend]

Public Member Functions

 Gate ()
 
 Gate (const std::vector< size_t > &nlevels_, const std::vector< size_t > &nessential_, double time_, const std::vector< double > &gate_rot_freq, DecoherenceType decoherence_type_, bool quietmode=false)
 Constructor for quantum gates.
 
virtual ~Gate ()
 
PetscInt getDimRho ()
 Retrieves the dimension of the density matrix.
 
void assembleGate ()
 Assembles the vectorized gate matrix.
 
void applyGate (const Vec state, Vec VrhoV)
 Applies the gate transformation to a quantum state.
 

Protected Attributes

Mat V_re
 
Mat V_im
 Real and imaginary parts of V_target, non-vectorized, essential levels only.
 
std::vector< size_t > nessential
 Number of essential levels per oscillator.
 
std::vector< size_t > nlevels
 Total number of levels per oscillator.
 
int mpirank_petsc
 MPI rank in PETSc communicator.
 
int mpisize_petsc
 MPI size in PETSc communicator.
 
int mpirank_world
 MPI rank in world communicator.
 
bool quietmode
 Flag to suppress output messages.
 
PetscInt dim_ess
 Dimension of target gate matrix (non-vectorized), essential levels only.
 
PetscInt dim_rho
 Dimension of system matrix rho (non-vectorized), all levels, N.
 
double final_time
 Final time T. Time of gate rotation.
 
std::vector< double > gate_rot_freq
 Frequencies of gate rotation (rad/time). Default: 0.0.
 
DecoherenceType decoherence_type
 Type of Lindblad operators for open system dynamics.
 

Detailed Description

Base class for quantum gate operations.

The Gate class provides the fundamental interface for quantum gate operations in quantum optimal control. It handles the transformation \(V \rho V^\dagger\) where \(V\) is the unitary gate matrix (target unitary transformation).

Constructor & Destructor Documentation

◆ Gate() [1/2]

Gate::Gate ( )

◆ Gate() [2/2]

Gate::Gate ( const std::vector< size_t > &  nlevels_,
const std::vector< size_t > &  nessential_,
double  time_,
const std::vector< double > &  gate_rot_freq,
DecoherenceType  decoherence_type_,
bool  quietmode = false 
)

Constructor for quantum gates.

Parameters
nlevels_Number of levels per oscillator.
nessential_Number of essential levels per oscillator.
time_Final time for gate rotation.
gate_rot_freqFrequencies of gate rotation (rad/time).
decoherence_type_Type of Lindblad operators for open system dynamics.
quietmodeFlag to suppress output messages (default: false).

◆ ~Gate()

Gate::~Gate ( )
virtual

Member Function Documentation

◆ applyGate()

void Gate::applyGate ( const Vec  state,
Vec  VrhoV 
)

Applies the gate transformation to a quantum state.

Computes \(V\rho V^\dagger\) where \(V\) is the gate matrix and \(\rho\) is the input state. The output vector VrhoV must be pre-allocated.

Parameters
stateInput quantum state vector.
VrhoVOutput vector storing the transformed state.

◆ assembleGate()

void Gate::assembleGate ( )

Assembles the vectorized gate matrix.

Computes VxV_re = \(\text{Re}(\bar{V} \otimes V)\) and VxV_im = \(\text{Im}(\bar{V} \otimes V)\) where V is the gate matrix.

◆ getDimRho()

PetscInt Gate::getDimRho ( )
inline

Retrieves the dimension of the density matrix.

Returns
PetscInt Dimension of the system density matrix (all levels).

Member Data Documentation

◆ decoherence_type

DecoherenceType Gate::decoherence_type
protected

Type of Lindblad operators for open system dynamics.

◆ dim_ess

PetscInt Gate::dim_ess
protected

Dimension of target gate matrix (non-vectorized), essential levels only.

◆ dim_rho

PetscInt Gate::dim_rho
protected

Dimension of system matrix rho (non-vectorized), all levels, N.

◆ final_time

double Gate::final_time
protected

Final time T. Time of gate rotation.

◆ gate_rot_freq

std::vector<double> Gate::gate_rot_freq
protected

Frequencies of gate rotation (rad/time). Default: 0.0.

◆ mpirank_petsc

int Gate::mpirank_petsc
protected

MPI rank in PETSc communicator.

◆ mpirank_world

int Gate::mpirank_world
protected

MPI rank in world communicator.

◆ mpisize_petsc

int Gate::mpisize_petsc
protected

MPI size in PETSc communicator.

◆ nessential

std::vector<size_t> Gate::nessential
protected

Number of essential levels per oscillator.

◆ nlevels

std::vector<size_t> Gate::nlevels
protected

Total number of levels per oscillator.

◆ quietmode

bool Gate::quietmode
protected

Flag to suppress output messages.

◆ V_im

Mat Gate::V_im
protected

Real and imaginary parts of V_target, non-vectorized, essential levels only.

◆ V_re

Mat Gate::V_re
protected

The documentation for this class was generated from the following files: