GM2Calc 2.3.0
Loading...
Searching...
No Matches
gm2_numerics.cpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of GM2Calc.
3//
4// GM2Calc is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// GM2Calc is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with GM2Calc. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
19#include "gm2_numerics.hpp"
20
21namespace gm2calc {
22
23double abs_sqrt(double x) noexcept {
24 return std::sqrt(std::abs(x));
25}
26
27int sign(double x) noexcept {
28 return std::signbit(x) ? -1 : 1;
29}
30
31double signed_sqr(double x) noexcept {
32 return std::copysign(x*x, x);
33}
34
35double signed_abs_sqrt(double x) noexcept {
36 return std::copysign(abs_sqrt(x), x);
37}
38
39} // namespace gm2calc
double abs_sqrt(double x) noexcept
returns square root of absolute of number
void svd_eigen(const Eigen::Matrix< Scalar, M, N > &m, Eigen::Array< Real,(((M)<(N)) ?(M) :(N)), 1 > &s, Eigen::Matrix< Scalar, M, M > *u, Eigen::Matrix< Scalar, N, N > *vh)
int sign(double x) noexcept
returns sign of real number
double signed_abs_sqrt(double x) noexcept
returns square root of absolute of number, times sign
double signed_sqr(double x) noexcept
returns square of number, times sign