Peano
Loading...
Searching...
No Matches
Scalar.cpp
Go to the documentation of this file.
1#include "tarch/la/Scalar.h"
2
3#include <algorithm>
4#include <cmath>
5
7
8double tarch::la::max(double a, double b, double c) { return std::max(a, std::max(b, c)); }
9
10double tarch::la::relativeEpsNormalisedAgainstValueGreaterOne(double valueA, double valueB, double eps) {
11 return eps * std::max(
12 std::max( std::abs(valueA), 1.0 ),
13 std::max( std::abs(valueB), 1.0 )
14 );
15}
16
17double tarch::la::relativeEps(double valueA, double valueB, double eps) {
18 return eps * std::max(std::abs(valueA), std::abs(valueB));
19}
20
21#ifdef CompilerICC
22#include <mathimf.h>
23
24double tarch::la::pow(double base, double exponent) { return pow(base, exponent); }
25#else
26double tarch::la::pow(double base, double exponent) { return std::pow(base, exponent); }
27#endif
28
29double tarch::la::convertAbsoluteIntoRelativeValue(double referenceValue, double value) {
30 const double weight = std::max(1.0, std::abs(referenceValue));
31 return value / weight;
32}
const float const float const float struct part *restrict struct part *restrict const float a
Definition hydro_iact.h:55
CF abs(const CF &cf)
double relativeEpsNormalisedAgainstValueGreaterOne(double valueA, double valueB=std::numeric_limits< double >::min(), double eps=NUMERICAL_ZERO_DIFFERENCE)
Determine a relative tolerance from one or two values.
Definition Scalar.cpp:10
double relativeEps(double valueA, double valueB=std::numeric_limits< double >::min(), double eps=NUMERICAL_ZERO_DIFFERENCE)
Determine a relative tolerance from one or two values.
Definition Scalar.cpp:17
double max(double a, double b, double c)
I need the maximum of three values all the time, to I decided to write a function for this.
Definition Scalar.cpp:8
double convertAbsoluteIntoRelativeValue(double referenceValue, double value)
Convert an absolute value into a relative one.
Definition Scalar.cpp:29
double pow(double base, double exponent)
Wrapper around std::pow which is redirected to Intel's implementation on Intel machines.
Definition Scalar.cpp:26