Optimization target specification for quantum control.
More...
#include <optimtarget.hpp>
|
| | OptimTarget () |
| |
| | OptimTarget (const Config &config, MasterEq *mastereq, bool quietmode_) |
| | Constructor with full target specification.
|
| |
| | ~OptimTarget () |
| |
| Vec | getInitialState () |
| |
| ObjectiveType | getObjectiveType () |
| |
| int | prepareInitialAndTargetState (const int iinit, const int ninit, const std::vector< size_t > &nlevels, const std::vector< size_t > &nessential) |
| | Prepares the initial condition state and target state.
|
| |
| void | evalJ (const Vec state, double *J_re_ptr, double *J_im_ptr) |
| | Evaluates the final-time objective function measure \(J(\rho(T))\).
|
| |
| void | evalJ_diff (const Vec state, Vec statebar, const double J_re_bar, const double J_im_bar) |
| | Computes derivative of the final-time objective function measure.
|
| |
| double | finalizeJ (const double obj_cost_re, const double obj_cost_im) |
| | Finalizes the objective function computation.
|
| |
| void | finalizeJ_diff (const double obj_cost_re, const double obj_cost_im, double *obj_cost_re_bar, double *obj_cost_im_bar) |
| | Derivative of objective function finalization.
|
| |
| double | FrobeniusDistance (const Vec state) |
| | Computes Frobenius distance between target and current state.
|
| |
| void | FrobeniusDistance_diff (const Vec state, Vec statebar, const double Jbar) |
| | Derivative of Frobenius distance computation.
|
| |
| void | HilbertSchmidtOverlap (const Vec state, const bool scalebypurity, double *HS_re_ptr, double *Hs_im_ptr) |
| | Computes Hilbert-Schmidt overlap between state and target.
|
| |
| void | HilbertSchmidtOverlap_diff (Vec statebar, bool scalebypurity, const double HS_re_bar, const double HS_im_bar) |
| | Derivative of Hilbert-Schmidt overlap computation.
|
| |
|
| PetscInt | dim |
| | State dimension of full vectorized system: N^2 if Lindblad, N if Schroedinger.
|
| |
| PetscInt | dim_rho |
| | Dimension of Hilbert space = N.
|
| |
| PetscInt | dim_ess |
| | Dimension of essential level system = N_e.
|
| |
| int | noscillators |
| | Number of oscillators in the system.
|
| |
| TargetType | target_type |
| | Type of optimization target (product state preparation or gate optimization)
|
| |
| ObjectiveType | objective_type |
| | Type of objective function measure (Frobenius, trace, product-state measure)
|
| |
| Gate * | targetgate |
| | Pointer to target gate (if gate optimization)
|
| |
| double | purity_rho0 |
| | Purity of initial state Tr(rho(0)^2)
|
| |
| PetscInt | purestateID |
| | For product state preparation: integer m for preparing the target state \( e_m e_m^{\dagger}\).
|
| |
| Vec | targetstate |
| | Storage for the target state vector (NULL for product states, \(V\rho V^\dagger\) for gates, density matrix from file)
|
| |
| Vec | initialstate |
| | Storing the initial state vector.
|
| |
| InitialConditionSettings | initcond |
| | Initial conditions.
|
| |
| DecoherenceType | decoherence_type |
| | Type of Lindblad decoherence operators, or NONE for Schroedinger solver.
|
| |
| int | mpisize_petsc |
| | Size of PETSc communicator.
|
| |
| int | mpirank_petsc |
| | Rank of PETSc 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.
|
| |
| Vec | aux |
| | Auxiliary vector for gate optimization objective computation.
|
| |
| bool | quietmode |
| | Flag for quiet mode operation.
|
| |
Optimization target specification for quantum control.
This class manages the target specification for quantum optimal control problems, including gate optimization and product state preparation. It handles target and initial state preparation and the evaluation of the final-time objective function measure.
Main functionality:
This class contains references to:
- Gate for evaluating the target state for quantum gate optimization
◆ OptimTarget() [1/2]
| OptimTarget::OptimTarget |
( |
| ) |
|
◆ OptimTarget() [2/2]
| OptimTarget::OptimTarget |
( |
const Config & |
config, |
|
|
MasterEq * |
mastereq, |
|
|
bool |
quietmode_ |
|
) |
| |
Constructor with full target specification.
- Parameters
-
| config | Configuration parameters |
| mastereq | Pointer to master equation solver |
| quietmode_ | Flag for quiet operation |
◆ ~OptimTarget()
| OptimTarget::~OptimTarget |
( |
| ) |
|
◆ evalJ()
| void OptimTarget::evalJ |
( |
const Vec |
state, |
|
|
double * |
J_re_ptr, |
|
|
double * |
J_im_ptr |
|
) |
| |
Evaluates the final-time objective function measure \(J(\rho(T))\).
The target state must be prepared and stored before calling this function. Returns both real and imaginary parts of the final-time measure. The imaginary part is generally zero except for Schroedinger solver with the trace objective function measure.
- Parameters
-
| [in] | state | Current state vector |
| [out] | J_re_ptr | Pointer to store real part of objective |
| [out] | J_im_ptr | Pointer to store imaginary part of objective |
◆ evalJ_diff()
| void OptimTarget::evalJ_diff |
( |
const Vec |
state, |
|
|
Vec |
statebar, |
|
|
const double |
J_re_bar, |
|
|
const double |
J_im_bar |
|
) |
| |
Computes derivative of the final-time objective function measure.
Updates the adjoint state vector for gradient computation.
- Parameters
-
| state | Final-time state vector |
| statebar | Adjoint state vector to update |
| J_re_bar | Adjoint of real part of objective |
| J_im_bar | Adjoint of imaginary part of objective |
◆ finalizeJ()
| double OptimTarget::finalizeJ |
( |
const double |
obj_cost_re, |
|
|
const double |
obj_cost_im |
|
) |
| |
Finalizes the objective function computation.
Compute the infidelity (1-fidelity).
- Parameters
-
| obj_cost_re | Real part of objective cost |
| obj_cost_im | Imaginary part of objective cost |
- Returns
- double Final objective function value
◆ finalizeJ_diff()
| void OptimTarget::finalizeJ_diff |
( |
const double |
obj_cost_re, |
|
|
const double |
obj_cost_im, |
|
|
double * |
obj_cost_re_bar, |
|
|
double * |
obj_cost_im_bar |
|
) |
| |
Derivative of objective function finalization.
- Parameters
-
| [in] | obj_cost_re | Real part of objective cost |
| [in] | obj_cost_im | Imaginary part of objective cost |
| [out] | obj_cost_re_bar | Pointer to store adjoint of real part |
| [out] | obj_cost_im_bar | Pointer to store adjoint of imaginary part |
◆ FrobeniusDistance()
| double OptimTarget::FrobeniusDistance |
( |
const Vec |
state | ) |
|
Computes Frobenius distance between target and current state.
Calculates \(F = 1/2 || \rho_{target} - \rho||^2_F\)
- Parameters
-
| state | Current state vector |
- Returns
- double Frobenius distance
◆ FrobeniusDistance_diff()
| void OptimTarget::FrobeniusDistance_diff |
( |
const Vec |
state, |
|
|
Vec |
statebar, |
|
|
const double |
Jbar |
|
) |
| |
Derivative of Frobenius distance computation.
- Parameters
-
| state | Current state vector |
| statebar | Adjoint state vector to update |
| Jbar | Adjoint seed |
◆ getInitialState()
| Vec OptimTarget::getInitialState |
( |
| ) |
|
|
inline |
◆ getObjectiveType()
◆ HilbertSchmidtOverlap()
| void OptimTarget::HilbertSchmidtOverlap |
( |
const Vec |
state, |
|
|
const bool |
scalebypurity, |
|
|
double * |
HS_re_ptr, |
|
|
double * |
Hs_im_ptr |
|
) |
| |
Computes Hilbert-Schmidt overlap between state and target.
Calculates \( Tr(\rho^\dagger \rho_{target})\), optionally scaled by the purity of the target state.
- Parameters
-
| state | Current state vector |
| scalebypurity | Flag to scale by purity of target state |
| HS_re_ptr | Pointer to store real part of overlap |
| Hs_im_ptr | Pointer to store imaginary part of overlap |
◆ HilbertSchmidtOverlap_diff()
| void OptimTarget::HilbertSchmidtOverlap_diff |
( |
Vec |
statebar, |
|
|
bool |
scalebypurity, |
|
|
const double |
HS_re_bar, |
|
|
const double |
HS_im_bar |
|
) |
| |
Derivative of Hilbert-Schmidt overlap computation.
- Parameters
-
| statebar | Adjoint state vector to update |
| scalebypurity | Flag to scale by purity of target state |
| HS_re_bar | Adjoint of real part of overlap |
| HS_im_bar | Adjoint of imaginary part of overlap |
◆ prepareInitialAndTargetState()
| int OptimTarget::prepareInitialAndTargetState |
( |
const int |
iinit, |
|
|
const int |
ninit, |
|
|
const std::vector< size_t > & |
nlevels, |
|
|
const std::vector< size_t > & |
nessential |
|
) |
| |
Prepares the initial condition state and target state.
The initial state was either stored during construction, or will be prepared here. For gate optimization, the target state is prepared by applying the target gate \(V \rho V^{\dagger}\) to the initial state. Also stores the purity of \(rho\) needed for scaling the Hilbert-Schmidt overlap in the trace objective function.
- Parameters
-
| iinit | Index in processor range [rank * ninit_local .. (rank+1) * ninit_local - 1] |
| ninit | Total number of initial conditions |
| nlevels | Number of levels per oscillator |
| nessential | Number of essential levels per oscillator |
- Returns
- int Identifier for this initial condition (element number in matrix vectorization)
◆ aux
Auxiliary vector for gate optimization objective computation.
◆ decoherence_type
Type of Lindblad decoherence operators, or NONE for Schroedinger solver.
◆ dim
| PetscInt OptimTarget::dim |
|
protected |
State dimension of full vectorized system: N^2 if Lindblad, N if Schroedinger.
◆ dim_ess
| PetscInt OptimTarget::dim_ess |
|
protected |
Dimension of essential level system = N_e.
◆ dim_rho
| PetscInt OptimTarget::dim_rho |
|
protected |
Dimension of Hilbert space = N.
◆ ilow
| PetscInt OptimTarget::ilow |
|
protected |
First index of the local sub vector u,v.
◆ initcond
◆ initialstate
| Vec OptimTarget::initialstate |
|
protected |
Storing the initial state vector.
◆ iupp
| PetscInt OptimTarget::iupp |
|
protected |
Last index (+1) of the local sub vector u,v.
◆ localsize_u
| PetscInt OptimTarget::localsize_u |
|
protected |
Size of local sub vector u or v in state x=[u,v].
◆ mpirank_petsc
| int OptimTarget::mpirank_petsc |
|
protected |
Rank of PETSc communicator.
◆ mpisize_petsc
| int OptimTarget::mpisize_petsc |
|
protected |
Size of PETSc communicator.
◆ noscillators
| int OptimTarget::noscillators |
|
protected |
Number of oscillators in the system.
◆ objective_type
Type of objective function measure (Frobenius, trace, product-state measure)
◆ purestateID
| PetscInt OptimTarget::purestateID |
|
protected |
For product state preparation: integer m for preparing the target state \( e_m e_m^{\dagger}\).
◆ purity_rho0
| double OptimTarget::purity_rho0 |
|
protected |
Purity of initial state Tr(rho(0)^2)
◆ quietmode
| bool OptimTarget::quietmode |
|
protected |
Flag for quiet mode operation.
◆ target_type
Type of optimization target (product state preparation or gate optimization)
◆ targetgate
| Gate* OptimTarget::targetgate |
|
protected |
Pointer to target gate (if gate optimization)
◆ targetstate
| Vec OptimTarget::targetstate |
|
protected |
Storage for the target state vector (NULL for product states, \(V\rho V^\dagger\) for gates, density matrix from file)
The documentation for this class was generated from the following files: