64 , state_(
std::arg(sqrt))
78 const T RANGE = 0.25*PI;
92 if (-RANGE < rot && rot < RANGE) {
95 else if (rot > PI-RANGE || rot < -PI+RANGE) {
102 throw std::runtime_error(
"continuous_sqrt: too large deviation between computed square root and reference solution");
118 state_ = 0.5*std::arg(input);
121 state_ =
continuate(state_, 0.5*std::arg(input) );
124 sqrt_ = std::polar(std::sqrt(std::abs(input)), state_);
std::complex< T > operator()() const
Retrieve the stored reference solution.
Definition: continuous_sqrt.hpp:132
std::complex< T > operator()(std::complex< T > input)
Solves the quadratic equation .
Definition: continuous_sqrt.hpp:115
Definition: coefficients_file_parser.cpp:10
Definition: stdarray2stream.hpp:7
std::complex< T > sqrt_
Definition: continuous_sqrt.hpp:32
T get_state(void) const
getter for state state
Definition: continuous_sqrt.hpp:140
ContinuousSqrt()
Delayes initialization of the stored reference solution.
Definition: continuous_sqrt.hpp:51
bool empty_
Definition: continuous_sqrt.hpp:43
ContinuousSqrt(std::complex< T > sqrt)
Initializes the stored reference solution to a chosen value.
Definition: continuous_sqrt.hpp:62
static T continuate(T ref, T arg)
Definition: continuous_sqrt.hpp:75
T state_
Definition: continuous_sqrt.hpp:38
This class deals with the issue, that the square root of complex numbers is not unique.
Definition: continuous_sqrt.hpp:26