Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math::complex_base< ValueType > Class Template Reference

Detailed Description

template<typename ValueType>
class stan::math::complex_base< ValueType >

Base class for complex numbers.

Extending classes must be of of the form complex<ValueType>.

Template Parameters
ValueTypetype of real and imaginary parts

Definition at line 18 of file complex_base.hpp.

#include <complex_base.hpp>

Public Types

using value_type = ValueType
 Type of real and imaginary parts.
 
using complex_type = std::complex< value_type >
 Derived complex type used for function return types.
 

Public Member Functions

 complex_base ()=default
 Construct a complex base with zero real and imaginary parts.
 
template<typename U >
 complex_base (const U &re)
 Construct a complex base with the specified real part and a zero imaginary part.
 
template<typename U , typename V >
 complex_base (const U &re, const V &im)
 Construct a complex base with the specified real and imaginary parts.
 
value_type real () const
 Return the real part.
 
void real (const value_type &re)
 Set the real part to the specified value.
 
value_type imag () const
 Return the imaginary part.
 
void imag (const value_type &im)
 Set the imaginary part to the specified value.
 
template<typename U , typename = require_stan_scalar_t<U>>
complex_typeoperator= (U &&re)
 Assign the specified value to the real part of this complex number and set imaginary part to zero.
 
template<typename U >
complex_typeoperator+= (const U &x)
 Add specified real value to real part.
 
template<typename U >
complex_typeoperator+= (const std::complex< U > &other)
 Adds specified complex number to this.
 
template<typename U >
complex_typeoperator-= (const U &x)
 Subtracts specified real number from real part.
 
template<typename U >
complex_typeoperator-= (const std::complex< U > &other)
 Subtracts specified complex number from this.
 
template<typename U >
complex_typeoperator*= (const U &x)
 Multiplies this by the specified real number.
 
template<typename U >
complex_typeoperator*= (const std::complex< U > &other)
 Multiplies this by specified complex number.
 
template<typename U >
complex_typeoperator/= (const U &x)
 Divides this by the specified real number.
 
template<typename U >
complex_typeoperator/= (const std::complex< U > &other)
 Divides this by the specified complex number.
 

Protected Member Functions

complex_typederived ()
 Return this complex base cast to the complex type.
 

Protected Attributes

value_type re_ {0}
 Real part.
 
value_type im_ {0}
 Imaginary part.
 

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