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

Control parameterization using quadratic (2nd order) Bspline basis functions. More...

#include <controlbasis.hpp>

Inheritance diagram for BSpline2nd:
Inheritance graph
[legend]
Collaboration diagram for BSpline2nd:
Collaboration graph
[legend]

Public Member Functions

 BSpline2nd (int nsplines, double tstart, double tstop, bool enforceZeroBoundary)
 Constructor for quadratic Bsplines.
 
 ~BSpline2nd ()
 
int getNSplines ()
 Retrieves the number of splines (default implementation returns 0).
 
void enforceBoundary (double *x, int carrier_id)
 Sets the first and last two spline coefficients in x to zero for this carrier wave, so that the controls start and end at zero.
 
void evaluate (const double t, const std::vector< double > &coeff, int carrier_freq_id, double *Blt1_ptr, double *Blt2_ptr)
 Evaluates the control basis at a given time using the provided coefficients.
 
void derivative (const double t, const std::vector< double > &coeff, double *coeff_diff, const double valbar1, const double valbar2, int carrier_freq_id)
 Evaluates the derivative of the control basis at a given time.
 
- Public Member Functions inherited from ControlBasis
 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 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).
 

Protected Member Functions

double basisfunction (int id, double t)
 Evaluate one basis function B_i(tau_i(t)).
 

Protected Attributes

int nsplines
 Number of splines.
 
double dtknot
 Spacing of time knot vector.
 
double * tcenter
 Vector of basis function center positions.
 
double width
 Support of each basis function (m*dtknot).
 
- Protected Attributes inherited from ControlBasis
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

Control parameterization using quadratic (2nd order) Bspline basis functions.

Bspline basis functions have local support with width = 3*dtknot, where dtknot = T/(nsplines -2) is the time knot vector spacing.

Constructor & Destructor Documentation

◆ BSpline2nd()

BSpline2nd::BSpline2nd ( int  nsplines,
double  tstart,
double  tstop,
bool  enforceZeroBoundary 
)

Constructor for quadratic Bsplines.

Parameters
nsplinesNumber of splines.
tstartStart time of the interval.
tstopStop time of the interval.
enforceZeroBoundaryFlag to enforce zero boundary conditions.

◆ ~BSpline2nd()

BSpline2nd::~BSpline2nd ( )

Member Function Documentation

◆ basisfunction()

double BSpline2nd::basisfunction ( int  id,
double  t 
)
protected

Evaluate one basis function B_i(tau_i(t)).

Parameters
idIndex of the basis function.
tTime at which to evaluate.
Returns
double Value of the basis function.

◆ derivative()

void BSpline2nd::derivative ( const double  t,
const std::vector< double > &  coeff,
double *  coeff_diff,
const double  valbar1,
const double  valbar2,
int  carrier_freq_id 
)
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.

Implements ControlBasis.

◆ enforceBoundary()

void BSpline2nd::enforceBoundary ( double *  x,
int  carrier_id 
)
virtual

Sets the first and last two spline coefficients in x to zero for this carrier wave, so that the controls start and end at zero.

Parameters
xPointer to the control parameters.
carrier_idID of the carrier wave.

Reimplemented from ControlBasis.

◆ evaluate()

void BSpline2nd::evaluate ( const double  t,
const std::vector< double > &  coeff,
int  carrier_freq_id,
double *  Blt1,
double *  Blt2 
)
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.

Implements ControlBasis.

◆ getNSplines()

int BSpline2nd::getNSplines ( )
inlinevirtual

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

Returns
int Number of splines.

Reimplemented from ControlBasis.

Member Data Documentation

◆ dtknot

double BSpline2nd::dtknot
protected

Spacing of time knot vector.

◆ nsplines

int BSpline2nd::nsplines
protected

Number of splines.

◆ tcenter

double* BSpline2nd::tcenter
protected

Vector of basis function center positions.

◆ width

double BSpline2nd::width
protected

Support of each basis function (m*dtknot).


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