1#ifndef XPED_COMPLEX_VARI_HPP_
2#define XPED_COMPLEX_VARI_HPP_
4#include "stan/math/rev/core/vari.hpp"
9class vari_value<std::complex<double>, void> :
public vari_base
12 using value_type = std::complex<double>;
16 const value_type val_;
21 value_type adj_{0.0, 0.0};
36 template <
typename S, require_convertible_t<S&, std::complex<
double>>* =
nullptr>
37 vari_value(S x) noexcept
40 ChainableStack::instance_->var_stack_.push_back(
this);
58 template <
typename S, require_convertible_t<S&, std::complex<
double>>* =
nullptr>
59 vari_value(S x,
bool stacked) noexcept
63 ChainableStack::instance_->var_stack_.push_back(
this);
65 ChainableStack::instance_->var_nochain_stack_.push_back(
this);
74 inline const auto& val()
const {
return val_; }
84 inline auto& adj()
const {
return adj_; }
94 inline auto& adj() {
return adj_; }
96 inline void chain() {}
104 inline void init_dependent() noexcept { adj_ = {1.0, 0.0}; }
111 inline void set_zero_adjoint() noexcept final { adj_ = {0.0, 0.0}; }
122 friend std::ostream&
operator<<(std::ostream& os,
const vari_value<value_type>* v) {
return os << v->val_ <<
":" << v->adj_; }
125 template <
typename,
typename>
126 friend class var_value;
std::ostream & operator<<(std::ostream &os, const FusionTree< depth, Symmetry > &tree)
Definition: FusionTree.hpp:93