|
Quandary
|
Quantum oscillator (multi-level qubit) with control capabilities. More...
#include <oscillator.hpp>
Public Member Functions | |
| Oscillator () | |
| Oscillator (const Config &config, size_t id, std::mt19937 rand_engine, int param_offset, bool quietmode) | |
| Constructor with simplified configuration-based specification. | |
| virtual | ~Oscillator () |
| size_t | getNParams () |
| Retrieves the number of control parameters. | |
| size_t | getNLevels () |
| Retrieves the number of energy levels. | |
| double | getSelfkerr () |
| Retrieves the self-Kerr coefficient. | |
| double | getDetuning () |
| Retrieves the detuning frequency. | |
| double | getDecayTime () |
| Retrieves the T1 decay time. | |
| double | getDephaseTime () |
| Retrieves the T2 dephasing time. | |
| size_t | getNParameterizations () |
| Retrieves the number of control parameterizations in this oscillator (currently always 1). | |
| size_t | getNCarrierfrequencies () |
| Retrieves the number of carrier frequencies. | |
| ControlType | getControlType () |
| Retrieves the type of control parameterization. | |
| int | getNSplines () |
| Retrieves the number of splines used in the control parameterization. | |
| double | getRotFreq () |
| Retrieves the rotating frame frequency. | |
| int | getNSegParams (int parameterizationID) |
| Retrieves the number of parameters for a specific parameterization. | |
| void | setParams (const double *x) |
| Sets control parameters from a global storage. | |
| void | getParams (double *x) |
| Retrieves control parameters into a global storage. | |
| void | clearParams () |
| Clears all control parameters. | |
| int | evalControl (const double t, double *Re_ptr, double *Im_ptr) |
| Evaluates the rotating-frame control functions. | |
| int | evalControl_diff (const double t, double *grad_for_this_oscillator, const double pbar, const double qbar) |
| Computes derivatives of control functions p(t) and q(t) with respect to the parameters. | |
| int | evalControl_Labframe (const double t, double *f_ptr) |
| Evaluates lab-frame control function. | |
| double | expectedEnergy (const Vec x) |
| Computes expected energy for this oscillator. | |
| void | expectedEnergy_diff (const Vec x, Vec x_bar, const double obj_bar) |
| Computes derivative of expected energy computation. | |
| void | population (const Vec x, std::vector< double > &pop) |
| Computes population in each energy level of this oscillator. | |
| double | evalControlVariation () |
| Evaluates control variation penalty term. | |
| void | evalControlVariationDiff (Vec G, double var_reg_bar, int skip_to_oscillator) |
| Computes derivative of control variation penalty. | |
Public Attributes | |
| PetscInt | dim_preOsc |
| Dimension of coupled subsystems preceding this oscillator. | |
| PetscInt | dim_postOsc |
| Dimension of coupled subsystems following this oscillator. | |
Protected Attributes | |
| int | myid |
| Integer identifier for this oscillator. | |
| size_t | nlevels |
| Number of energy levels for this oscillator. | |
| double | ground_freq |
| Fundamental 0-1 transition frequency of this oscillator \(\omega_k\). | |
| double | selfkerr |
| Self-Kerr frequency \(\xi_k\), multiplies \(a_k^\dagger a_k^\dagger a_k a_k\). | |
| double | detuning_freq |
| Detuning frequency, detuning = ground_freq - rotational_freq, multiplies \(a_k^\dagger a_k\). | |
| DecoherenceType | decoherence_type |
| Type of Lindblad decoherence operators to include. | |
| double | decay_time |
| Characteristic time for T1 decay operations. | |
| double | dephase_time |
| Characteristic time for T2 dephasing operations. | |
| std::vector< double > | params |
| Control parameters for this oscillator. | |
| double | Tfinal |
| Final evolution time. | |
| std::vector< ControlBasis * > | basisfunctions |
| Basis functions for control parameterization foreach time parameterization. Note: Currently only one parameterization is supported! | |
| std::vector< double > | carrier_freq |
| Frequencies of the carrier waves. | |
| int | mpirank_world |
| Rank of MPI_COMM_WORLD. | |
| int | mpirank_petsc |
| Rank of PETSc's communicator. | |
| int | mpisize_petsc |
| Size of PETSc's communicator. | |
| PetscInt | localsize_u |
| Size of local sub vector u or v in state x=[u,v]. | |
| PetscInt | ilow |
| First index of the local sub vector u,v. | |
| PetscInt | iupp |
| Last index (+1) of the local sub vector u,v. | |
| bool | control_zero_boundary_condition |
| Flag to enforce boundary conditions on controls. | |
Quantum oscillator (multi-level qubit) with control capabilities.
This class represents a single quantum oscillator that is controlled by external control pulses. It stores the oscillator parameters, such as number of energy levels, frequency detuning, anharmonicity and Lindblad decay and dephasing times.
It also manages this oscillator's control pulse parameterization and carrier wave frequencies.
Main functionality:
This class contains references to:
| Oscillator::Oscillator | ( | ) |
| Oscillator::Oscillator | ( | const Config & | config, |
| size_t | id, | ||
| std::mt19937 | rand_engine, | ||
| int | param_offset, | ||
| bool | quietmode | ||
| ) |
Constructor with simplified configuration-based specification.
| config | Configuration parameters containing all oscillator settings |
| id | Oscillator identifier |
| rand_engine | Random number generator engine |
| param_offset | Offset for global control parameter indexing |
| quietmode | Flag for quiet mode operation |
|
virtual |
|
inline |
Clears all control parameters.
Makes this oscillator non-controllable by removing all parameters.
| int Oscillator::evalControl | ( | const double | t, |
| double * | Re_ptr, | ||
| double * | Im_ptr | ||
| ) |
Evaluates the rotating-frame control functions.
Computes the real and imaginary parts of the control function: Re = p(t), Im = q(t)
| [in] | t | Time at which to evaluate |
| [out] | Re_ptr | Pointer to store real part p(t) |
| [out] | Im_ptr | Pointer to store imaginary part q(t) |
| int Oscillator::evalControl_diff | ( | const double | t, |
| double * | grad_for_this_oscillator, | ||
| const double | pbar, | ||
| const double | qbar | ||
| ) |
Computes derivatives of control functions p(t) and q(t) with respect to the parameters.
| [in] | t | Time at which to evaluate derivatives |
| [out] | grad_for_this_oscillator | Array to update the gradient |
| [in] | pbar | Adjoint scaling factor for the gradient of p (seed) |
| [in] | qbar | Adjoint scaling factor for the gradient of q (seed) |
| int Oscillator::evalControl_Labframe | ( | const double | t, |
| double * | f_ptr | ||
| ) |
Evaluates lab-frame control function.
| t | Time at which to evaluate |
| f_ptr | Pointer to store lab-frame control value |
| double Oscillator::evalControlVariation | ( | ) |
Evaluates control variation penalty term.
Computes finite-difference based regularization of control parameters.
| void Oscillator::evalControlVariationDiff | ( | Vec | G, |
| double | var_reg_bar, | ||
| int | skip_to_oscillator | ||
| ) |
Computes derivative of control variation penalty.
| G | Gradient vector to update |
| var_reg_bar | Adjoint of variation penalty |
| skip_to_oscillator | Offset to this oscillator's parameters in global vector |
| double Oscillator::expectedEnergy | ( | const Vec | x | ) |
Computes expected energy for this oscillator.
Returns the expected value of the number operator for this oscillator's subsystem.
| x | State vector |
| void Oscillator::expectedEnergy_diff | ( | const Vec | x, |
| Vec | x_bar, | ||
| const double | obj_bar | ||
| ) |
Computes derivative of expected energy computation.
| x | State vector |
| x_bar | Adjoint state vector to update |
| obj_bar | Adjoint of expected energy |
|
inline |
Retrieves the type of control parameterization.
|
inline |
Retrieves the T1 decay time.
|
inline |
Retrieves the T2 dephasing time.
|
inline |
Retrieves the detuning frequency.
|
inline |
Retrieves the number of carrier frequencies.
|
inline |
Retrieves the number of energy levels.
|
inline |
Retrieves the number of control parameterizations in this oscillator (currently always 1).
|
inline |
Retrieves the number of control parameters.
| int Oscillator::getNSegParams | ( | int | parameterizationID | ) |
Retrieves the number of parameters for a specific parameterization.
| parameterizationID | Segment identifier // Currently always 0! |
|
inline |
Retrieves the number of splines used in the control parameterization.
| void Oscillator::getParams | ( | double * | x | ) |
Retrieves control parameters into a global storage.
| x | Array to store control parameter values |
|
inline |
Retrieves the rotating frame frequency.
|
inline |
Retrieves the self-Kerr coefficient.
| void Oscillator::population | ( | const Vec | x, |
| std::vector< double > & | pop | ||
| ) |
Computes population in each energy level of this oscillator.
Extracts the diagonal elements of the reduced density matrix for this oscillator.
| x | State vector |
| pop | Reference to vector to store population values |
| void Oscillator::setParams | ( | const double * | x | ) |
Sets control parameters from a global storage.
| x | Array of control parameter values |
|
protected |
Basis functions for control parameterization foreach time parameterization. Note: Currently only one parameterization is supported!
|
protected |
Frequencies of the carrier waves.
|
protected |
Flag to enforce boundary conditions on controls.
|
protected |
Characteristic time for T1 decay operations.
|
protected |
Type of Lindblad decoherence operators to include.
|
protected |
Characteristic time for T2 dephasing operations.
|
protected |
Detuning frequency, detuning = ground_freq - rotational_freq, multiplies \(a_k^\dagger a_k\).
| PetscInt Oscillator::dim_postOsc |
Dimension of coupled subsystems following this oscillator.
| PetscInt Oscillator::dim_preOsc |
Dimension of coupled subsystems preceding this oscillator.
|
protected |
Fundamental 0-1 transition frequency of this oscillator \(\omega_k\).
|
protected |
First index of the local sub vector u,v.
|
protected |
Last index (+1) of the local sub vector u,v.
|
protected |
Size of local sub vector u or v in state x=[u,v].
|
protected |
Rank of PETSc's communicator.
|
protected |
Rank of MPI_COMM_WORLD.
|
protected |
Size of PETSc's communicator.
|
protected |
Integer identifier for this oscillator.
|
protected |
Number of energy levels for this oscillator.
|
protected |
Control parameters for this oscillator.
|
protected |
Self-Kerr frequency \(\xi_k\), multiplies \(a_k^\dagger a_k^\dagger a_k a_k\).
|
protected |
Final evolution time.