Automatic Differentiation
 
Loading...
Searching...
No Matches
std_complex.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_CORE_STD_COMPLEX_HPP
2#define STAN_MATH_FWD_CORE_STD_COMPLEX_HPP
3
7#include <complex>
8
9namespace std {
10
17template <typename T>
18class complex<stan::math::fvar<T>>
19 : public stan::math::complex_base<stan::math::fvar<T>> {
20 public:
22
26 complex() = default;
27
35 template <typename U, typename = stan::require_stan_scalar_t<U>>
36 complex(const U& re) : base_t(re) {} // NOLINT(runtime/explicit)
37
38 template <typename U>
39 complex(const std::complex<U>& z) // NOLINT(runtime/explicit)
40 : base_t(z.real(), z.imag()) {}
41
51 template <typename U, typename V>
52 complex(const U& re, const V& im) : base_t(re, im) {}
53
62 template <typename U, typename = stan::require_arithmetic_t<U>>
63 auto& operator=(const std::complex<U>& x) {
64 this->re_ = x.real();
65 this->im_ = x.imag();
66 return *this;
67 }
68};
69
70} // namespace std
71
72#endif
Base class for complex numbers.
complex(const std::complex< U > &z)
complex(const U &re)
Construct a complex number with the specified real part and a zero imaginary part.
complex(const U &re, const V &im)
Construct a complex number from the specified real and imaginary parts.
complex()=default
Construct a complex number with zero real and imaginary parts.
auto & operator=(const std::complex< U > &x)
Set the real and imaginary parts to those of the specified complex number.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9
STL namespace.