Peano
Loading...
Searching...
No Matches
ScalarOperations.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5
6#include "tarch/tarch.h"
7#include "tarch/la/Scalar.h"
8
9#pragma once
10
11#pragma once
12
13
14#pragma push_macro("Dimensions")
15#pragma push_macro("assertion")
16#undef Dimensions
17#undef assertion
18#include <complex>
19#pragma pop_macro("Dimensions")
20#pragma pop_macro("assertion")
21
22
23namespace tarch {
24 namespace la {
25
29 double abs( double value);
30
34 int abs (int value);
35
36 double abs( const std::complex<double>& value );
37
41 int aPowI(int i,int a);
42
46 inline bool greater( double lhs, double rhs, double tolerance = NUMERICAL_ZERO_DIFFERENCE) {
47 return lhs - rhs > tolerance;
48 }
49
53 bool greaterEquals( double lhs, double rhs, double tolerance = NUMERICAL_ZERO_DIFFERENCE);
54
58 bool equals( double lhs, double rhs, double tolerance = NUMERICAL_ZERO_DIFFERENCE);
59
89 [[maybe_unused]]
90 static InlineMethod bool smaller( double lhs, double rhs, double tolerance = NUMERICAL_ZERO_DIFFERENCE) {
91 return lhs - rhs < -tolerance;
92 }
93
97 bool smallerEquals( double lhs, double rhs, double tolerance = NUMERICAL_ZERO_DIFFERENCE);
98
102 bool equals( const std::complex<double>& lhs, const std::complex<double>& rhs, double tolerance = NUMERICAL_ZERO_DIFFERENCE);
103
107 int sign(double value, double tolerance = NUMERICAL_ZERO_DIFFERENCE);
108
109 int round(double value);
110 int round(float value);
111 }
112}
113
114
static InlineMethod bool smaller(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Smaller operator for floating point values.
bool greater(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool greaterEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
constexpr double NUMERICAL_ZERO_DIFFERENCE
Definition Scalar.h:17
double abs(double value)
Returns the absolute value of a type by redirecting to std::abs.
bool smallerEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
int sign(double value, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.
int aPowI(int i, int a)
Computes the i-th power of a in integer arithmetic.
int round(double value)
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
#define InlineMethod
Generic identifier for inlined functions.
Definition tarch.h:66