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

Discretization of the Controls using piece-wise constant (0-th order) Bsplines. More...

#include <controlbasis.hpp>

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

Public Member Functions

 BSpline0 (int nsplines, double tstart, double tstop, bool enforceZeroBoundary)
 
 ~BSpline0 ()
 
int getNSplines ()
 Retrieves the number of splines (default implementation returns 0).
 
void enforceBoundary (double *x, int carrier_id)
 Sets the first and last parameter to zero for this carrier wave, so that the controls start and end at zero.
 
double computeVariation (std::vector< double > &params, int carrierfreqID)
 Computes total variation of the control parameters.
 
virtual void computeVariation_diff (double *grad, std::vector< double > &params, double var_bar, int carrierfreqID)
 Computes derivative of control parameter variation.
 
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.
 

Protected Attributes

int nsplines
 Number of splines.
 
double dtknot
 Spacing of time knot vector.
 
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

Discretization of the Controls using piece-wise constant (0-th order) Bsplines.

This class parameterizes the control pulse using 0-th order Bspline basis functions (hat functions), with local support of width = T/nsplines.

Constructor & Destructor Documentation

◆ BSpline0()

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

◆ ~BSpline0()

BSpline0::~BSpline0 ( )

Member Function Documentation

◆ computeVariation()

double BSpline0::computeVariation ( std::vector< double > &  params,
int  carrierfreqID 
)
virtual

Computes total variation of the control parameters.

Computes \(\frac{1}{n_{splines}} \sum_{splines} (\alpha_i - \alpha_{i-1})^2\).

Parameters
paramsVector of control parameters
carrierfreqIDID of the carrier frequency
Returns
double Variation value

Reimplemented from ControlBasis.

◆ computeVariation_diff()

void BSpline0::computeVariation_diff ( double *  grad,
std::vector< double > &  params,
double  var_bar,
int  carrierfreqID 
)
virtual

Computes derivative of control parameter variation.

Parameters
gradPointer to gradient array to update
paramsVector of control parameters
var_barAdjoint of variation term
carrierfreqIDID of the carrier frequency

Reimplemented from ControlBasis.

◆ derivative()

void BSpline0::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 BSpline0::enforceBoundary ( double *  x,
int  carrier_id 
)
virtual

Sets the first and last parameter to zero for this carrier wave, so that the controls start and end at zero.

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

Reimplemented from ControlBasis.

◆ evaluate()

void BSpline0::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 BSpline0::getNSplines ( )
inlinevirtual

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

Returns
int Number of splines.

Reimplemented from ControlBasis.

Member Data Documentation

◆ dtknot

double BSpline0::dtknot
protected

Spacing of time knot vector.

◆ nsplines

int BSpline0::nsplines
protected

Number of splines.

◆ width

double BSpline0::width
protected

Support of each basis function (m*dtknot).


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