Beispiel #1
0
 /**
  * @brief Copy Constructor. The logic is handled by the tape.
  *
  * The tape is required to set the primal value of v to the primal value
  * of this type.
  *
  * @param[in] v The value to copy.
  */
 inline ActiveReal(const ActiveReal<Real, Tape>& v) {
   globalTape.initGradientData(this->primalValue, gradientData);
   globalTape.store(primalValue, gradientData, v);
 }
Beispiel #2
0
 inline ActiveReal(const Expression<Real, R>& rhs) {
   globalTape.initGradientData(this->primalValue, gradientData);
   globalTape.store(primalValue, gradientData, rhs.cast());
 }
Beispiel #3
0
 /**
  * @brief Sets the primal value of the origin and initializes the gradient data.
  *
  * Initializes the value of the start of the ActiveType chain with the value.
  *
  * @param[in] value   The primal value of the active type.
  */
 inline ActiveReal(const PassiveReal& value) : primalValue(value) {
   globalTape.initGradientData(this->primalValue, gradientData);
 }
Beispiel #4
0
 /**
  * @brief Sets the primal value of this ActiveReal and sets the gradient after it was initialized.
  *
  * @param[in]    value  The primal value for this type.
  * @param[in] gradient  The gradient value for this type.
  */
 inline ActiveReal(const Real& value, const Real& gradient) : primalValue(value) {
   globalTape.initGradientData(this->primalValue, gradientData);
   globalTape.setGradient(gradientData, gradient);
 }
Beispiel #5
0
 /**
  * @brief Constructs the equivalent of zero and initializes the gradient data.
  */
 inline ActiveReal() : primalValue() {
   globalTape.initGradientData(primalValue, gradientData);
 }