const_reference at(size_type __n) const { if (__n >= _Nm) std::__throw_out_of_range(__N("array::at")); return _M_instance[__n]; }
void XVMatrix::setValues(RTT::types::carray<double> & inputs) { if (sizeCheck(inputs.count())) { memcpy(mat, inputs.address(), size() * sizeof(double)); } else { std::__throw_out_of_range(__N("XVMatrix::_M_range_check")); } }
void XVMatrix::setValues(double & inputs, std::size_t size) { if (sizeCheck(size)) { memcpy(mat, &inputs, this->size() * sizeof(double)); } else { std::__throw_out_of_range(__N("XVMatrix::_M_range_check")); } }
void XVMatrix::setValues(std::vector<double> & inputs) { if (sizeCheck(inputs.size())) { memcpy(mat, inputs.data(), size() * sizeof(double)); } else { std::__throw_out_of_range(__N("XVMatrix::_M_range_check")); } }
__hankel_param_t<_Tp>::__hankel_param_t(std::complex<_Tp> __nu_in, std::complex<_Tp> __zhat_in) : __nu(__nu_in), __zhat(__zhat_in) { const auto _S_1d3 = _Tp{1} / _Tp{3}; const auto _S_2d3 = _Tp{2} / _Tp{3}; // -(2/3)ln(2/3) const auto _S_lncon = _Tp{0.2703100720721095879853420769762327577152Q}; const std::complex<_Tp> _S_j{0, 1}; //using _Cmplx = std::complex<_Tp>; const auto _S_sqrt_max = __gnu_cxx::__sqrt_max<_Tp>(); // If nu^2 can be computed without overflow. if (std::abs(__nu) <= _S_sqrt_max) { auto __nup2 = __nu * __nu; __num2 = _Tp{1} / __nup2; // Compute nu^(-1/3), nu^(-2/3), nu^(-4/3). __num1d3 = std::pow(__nu, -_S_1d3); __num2d3 = __num1d3 * __num1d3; __num4d3 = __num2d3 * __num2d3; } else std::__throw_runtime_error(__N("__hankel_param_t: " "unable to compute nu^2")); if (std::real(__zhat) <= _Tp{1}) { __w = std::sqrt((_Tp{1} + __zhat) * (_Tp{1} - __zhat)); __p = _Tp{1} / __w; __p2 = __p * __p; __xi = std::log(_Tp{1} + __w) - std::log(__zhat) - __w; //auto __zetam3hf = _S_2d3 / __xi; // zeta^(-3/2) auto __logzeta = _S_2d3 * std::log(__xi) + _S_lncon; // ln(zeta) __zeta = std::exp(__logzeta); __zetaphf = std::sqrt(__zeta); __zetamhf = _Tp{1} / __zetaphf; } else { __w = std::sqrt((__zhat + _Tp{1}) * (__zhat - _Tp{1})); __p = _S_j / __w; __p2 = __p * __p; __xi = __w - std::acos(_Tp{1} / __zhat); __zetam3hf = _S_j * _S_2d3 / __xi; // i(-zeta)^(-3/2) auto __logmzeta = _S_2d3 * std::log(__xi) + _S_lncon; // ln(-zeta) auto __mzeta = std::exp(__logmzeta); // -zeta __zetaphf = -_S_j * std::sqrt(__mzeta); // -i(-zeta)^(1/2) __zetamhf = _Tp{1} / __zetaphf; // i(-zeta)^(-1/2) __zeta = -__mzeta; } __thing = std::pow(_Tp{4} * __zeta / __w, _Tp{0.25L}); }
inline double lgamma(double z) { if(z > 0.5) return lnGammaLanczos(z); else { const double sin_fact = std::abs(std::sin(numeric_constants<double>::pi()*z)); if (sin_fact == double(0)) std::__throw_domain_error(__N("Argument is nonpositive integer " "in __log_gamma")); return numeric_constants<double>::lnpi() - std::log(sin_fact) - lnGammaLanczos(double(1) - z); } }
_Tp __log_gamma(_Tp __x) { typedef typename __ellint_traits<_Tp>::__value_type _Val; if (std::real(__x) > _Val(0.5L)) return __log_gamma_lanczos(__x); else { const _Tp __sin_fact = std::abs(std::sin(__numeric_constants<_Val>::__pi() * __x)); if (__sin_fact == _Tp(0)) std::__throw_domain_error(__N("Argument is nonpositive integer " "in __log_gamma")); return __numeric_constants<_Val>::__lnpi() - std::log(__sin_fact) - __log_gamma_lanczos(_Tp(1) - __x); } }
container_error() : std::logic_error(__N("__gnu_pbds::container_error")) { }
_Tp __ibeta_inv(_Tp __a, _Tp __b, _Tp _Ibeta) { constexpr auto _S_eps = std::numeric_limits<_Tp>::epsilon(); constexpr int _S_max_inner_iter = 12; constexpr int _S_max_outer_iter = 35; if (__a < _Tp{0} || __b < _Tp{0}) std::__throw_domain_error(__N("__ibeta_inv: " "parameters a and b must be positive")); else if (_Ibeta < _Tp{0} || _Ibeta > _Tp{1}) std::__throw_domain_error(__N("__ibeta_inv: " "incomplete beta function out of range")); const auto _Beta = std::beta(__a, __b); __gnu_cxx::__root_bracket([__a, __b](_Tp __x)->_Tp{ return __gnu_cxx::ibeta(__a, __b, __x); }, _Tp{0}, _Tp{1}); /* auto _Ix = _Ibeta; auto _Iy = _Tp{1} - _Ix; auto _Ixy_prev = std::min(_Ix, _Iy); _Tp __x_prev, __y_prev; if (__a <= __b) { __x_prev = std::pow(__a * _Ix * _Beta, _Tp{1} / __a); __y_prev = _Tp{1} - __x_prev; } else { __y_prev = std::pow(__b * _Iy * _Beta, _Tp{1} / __b); __x_prev = _Tp{1} - __y_prev; } auto __xy_prev = std::min(__x_prev, __y_prev); auto __xy_lower = _Tp{0}; auto __xy_upper = _Tp{1}; int __outer_iter = 0; while (__outer_iter++ < _S_max_outer_iter) { int __iter = 0; while (__iter++ < _S_max_inner_iter && _Ixy_prev < _Ixy) { __xy = _Tp{2} * __xy_prev; __xy_lower = __xy; } __iter = 0; while (__iter++ < _S_max_inner_iter && _Ixy_prev >= _Ixy) { __xy = __xy_prev / _Tp{2}; __xy_upper = __xy; } __xy = (__xy_lower + __xy_upper) / _Tp{2}; if (std::abs(__xy_upper - __xy_lower) < _S_eps * __xy) break; } */ auto __thing = [__a, __b](_Tp __x){ return __gnu_cxx::ibeta(__a, __b, __x); }; auto __xy_lower = _Tp{0}; auto __xy_upper = _Tp{1}; if (__gnu_cxx::__root_bracket(__thing, __xy_lower, __xy_upper)) { return __gnu_cxx::__root_brent(__thing, __xy_lower, __xy_upper, _Tp{10} * _S_eps); } }