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

Abstract base class for control parameterizations. More...

#include <controlbasis.hpp>

Inheritance diagram for ControlBasis:
Inheritance graph
[legend]

Public Member Functions

 ControlBasis ()
 
 ControlBasis (int nparams_, double tstart, double tstop, bool enforceZeroBoundary)
 Constructor with parameters.
 
virtual ~ControlBasis ()
 
int getNparams ()
 Retrieves the number of parameters defining the controls.
 
double getTstart ()
 Retrieves the start time of the interval.
 
double getTstop ()
 Retrieves the stop time of the interval.
 
ControlType getType ()
 Retrieves the type of control parameterization.
 
void setSkip (int skip_)
 Sets the offset for the starting location in the global control vector.
 
int getSkip ()
 Retrieves the offset for the starting location in the global control vector.
 
virtual int getNSplines ()
 Retrieves the number of splines (default implementation returns 0).
 
virtual double computeVariation (std::vector< double > &, int)
 Computes the variation of control parameters (default implementation returns 0.0).
 
virtual void computeVariation_diff (double *, std::vector< double > &, double, int)
 Computes the gradient of the variation (default implementation does nothing).
 
virtual void enforceBoundary (double *, int)
 Enforces boundary conditions for controls (default implementation does nothing).
 
virtual void evaluate (const double t, const std::vector< double > &coeff, int carrier_freq_id, double *Blt1, double *Blt2)=0
 Evaluates the control basis at a given time using the provided coefficients.
 
virtual void derivative (const double t, const std::vector< double > &coeff, double *coeff_diff, const double valbar1, const double valbar2, int carrier_freq_id)=0
 Evaluates the derivative of the control basis at a given time.
 

Protected Attributes

int nparams
 Number of parameters that define the control pulse.
 
double tstart
 Start time of the interval where the control basis is applied.
 
double tstop
 Stop time of the interval where the control basis is applied.
 
int skip
 Offset to the starting location for this basis inside the global control vector.
 
ControlType controltype
 Type of control parameterization.
 
bool enforceZeroBoundary
 Flag to enforce zero boundary conditions for control pulses.
 

Detailed Description

Abstract base class for control parameterizations.

The ControlBasis class defines the interface for various parameterizations of the control pulse envelopes, which are multiplied by carrier waves in the Oscillator class. Derived classes implement specific control parameterizations, such as the most standard parameterization via 2nd order Bsplines. Specific control parameterizations are initialized in the constructor of the oscillator.

Main functionality:

Constructor & Destructor Documentation

◆ ControlBasis() [1/2]

ControlBasis::ControlBasis ( )

◆ ControlBasis() [2/2]

ControlBasis::ControlBasis ( int  nparams_,
double  tstart,
double  tstop,
bool  enforceZeroBoundary 
)

Constructor with parameters.

Parameters
nparams_Number of parameters defining the controls.
tstartStart time of the interval.
tstopStop time of the interval.
enforceZeroBoundaryFlag to enforce zero boundary conditions. If true, ensures that the controls start and end at zero.

◆ ~ControlBasis()

ControlBasis::~ControlBasis ( )
virtual

Member Function Documentation

◆ computeVariation()

virtual double ControlBasis::computeVariation ( std::vector< double > &  ,
int   
)
inlinevirtual

Computes the variation of control parameters (default implementation returns 0.0).

Default implementation ignores all input parameters.

Returns
double Variation value.

Reimplemented in BSpline0.

◆ computeVariation_diff()

virtual void ControlBasis::computeVariation_diff ( double *  ,
std::vector< double > &  ,
double  ,
int   
)
inlinevirtual

Computes the gradient of the variation (default implementation does nothing).

Default implementation ignores all input parameters.

Reimplemented in BSpline0.

◆ derivative()

virtual void ControlBasis::derivative ( const double  t,
const std::vector< double > &  coeff,
double *  coeff_diff,
const double  valbar1,
const double  valbar2,
int  carrier_freq_id 
)
pure virtual

Evaluates the derivative of the control basis at a given time.

Parameters
tTime at which to evaluate.
coeffVector of coefficients.
coeff_diffPointer to the derivative coefficients.
valbar1Multiplier for the real derivative term.
valbar2Multiplier for the imaginary derivative term.
carrier_freq_idID of the carrier frequency.

Implemented in BSpline2nd, BSpline2ndAmplitude, and BSpline0.

◆ enforceBoundary()

virtual void ControlBasis::enforceBoundary ( double *  ,
int   
)
inlinevirtual

Enforces boundary conditions for controls (default implementation does nothing).

For some control parameterizations, this can be used to enforce that the controls start and end at zero. For example, the 2nd order Bspline parameterization will overwrite the parameters of the first and last two splines by zero, ensuring that the resulting control pulses start and end at zero.

Default implementation ignores all input parameters.

Reimplemented in BSpline2nd, BSpline2ndAmplitude, and BSpline0.

◆ evaluate()

virtual void ControlBasis::evaluate ( const double  t,
const std::vector< double > &  coeff,
int  carrier_freq_id,
double *  Blt1,
double *  Blt2 
)
pure virtual

Evaluates the control basis at a given time using the provided coefficients.

Parameters
[in]tTime at which to evaluate.
[in]coeffVector of parameters (coefficients of the basis parameterization).
[in]carrier_freq_idID of the carrier frequency, provided by the oscillator.
[out]Blt1Pointer to store the real part of the control parameterization.
[out]Blt2Pointer to store the imaginary part of the control parameterization.

Implemented in BSpline2nd, BSpline2ndAmplitude, and BSpline0.

◆ getNparams()

int ControlBasis::getNparams ( )
inline

Retrieves the number of parameters defining the controls.

Returns
int Number of parameters.

◆ getNSplines()

virtual int ControlBasis::getNSplines ( )
inlinevirtual

Retrieves the number of splines (default implementation returns 0).

Returns
int Number of splines.

Reimplemented in BSpline2nd, BSpline2ndAmplitude, and BSpline0.

◆ getSkip()

int ControlBasis::getSkip ( )
inline

Retrieves the offset for the starting location in the global control vector.

Returns
int Offset value.

◆ getTstart()

double ControlBasis::getTstart ( )
inline

Retrieves the start time of the interval.

Returns
double Start time.

◆ getTstop()

double ControlBasis::getTstop ( )
inline

Retrieves the stop time of the interval.

Returns
double Stop time.

◆ getType()

ControlType ControlBasis::getType ( )
inline

Retrieves the type of control parameterization.

Returns
ControlType Type of control.

◆ setSkip()

void ControlBasis::setSkip ( int  skip_)
inline

Sets the offset for the starting location in the global control vector.

Parameters
skip_Offset value.

Member Data Documentation

◆ controltype

ControlType ControlBasis::controltype
protected

Type of control parameterization.

◆ enforceZeroBoundary

bool ControlBasis::enforceZeroBoundary
protected

Flag to enforce zero boundary conditions for control pulses.

◆ nparams

int ControlBasis::nparams
protected

Number of parameters that define the control pulse.

◆ skip

int ControlBasis::skip
protected

Offset to the starting location for this basis inside the global control vector.

◆ tstart

double ControlBasis::tstart
protected

Start time of the interval where the control basis is applied.

◆ tstop

double ControlBasis::tstop
protected

Stop time of the interval where the control basis is applied.


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