-
Notifications
You must be signed in to change notification settings - Fork 15
/
commonFunctions.h
52 lines (47 loc) · 1.04 KB
/
commonFunctions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************-/
* This source code is subject to the terms of the GNU -/
* Lesser Public License. If a copy of the LGPL was not -/
* distributed with this file, you can obtain one at -/
* https://www.gnu.org/licenses/lgpl.html. -/
********************************************************/
/** \file commonFunctions.h
*
* \author Joey Dumont <[email protected]>
*
* \since 2014-07-10
*
* \brief Defines some common functions to the C++ and Fortran code.
*
* We define some functions that will be of use in both the C++ and Fortran
* parts of this library.
*
*/
namespace WignerSymbols {
template <typename T>
double sgn(T val)
{
return (T(0) < val) - (val < T(0));
}
template <typename T>
int maxThree(T a, T b, T c)
{
int maxIndex;
T max;
if (a > b)
{
max = a;
maxIndex = 1;
}
else
{
max = b;
maxIndex = 2;
}
if (max < c)
{
max = c;
maxIndex = 3;
}
return maxIndex;
}
}