C++ mpi module for stochmagnet_main Package
functions_complex.h
1 #ifndef FUNCTIONS_COMPLEX_H
2 #define FUNCTIONS_COMPLEX_H
3 
4 //types of the code
5 #include "types.h"
6 #include "functions_type.h"
7 
8 //standart library
9 #include <stdlib.h>
10 
11 //for type name
12 #include <cxxabi.h>
13 
14 //include the Template condition
15 #include<type_traits>
16 
17 //regex header for string manipulation
18 #include <regex>
19 
20 //template type verification header
21 #include<type_traits>
22 #include<concepts>
23 
24 //math header isnan
25 #include <math.h>
26 
27 #ifdef DEBUG
28 //define the assert method
29 #include<cassert>
30 #endif
31 
32 namespace functions_complex {
33 
34 
35  //complex multiplicator
36  template<typename Q>
37  inline const std::pair<Q,Q>& multiply(const std::pair<Q,Q>& alpha,std::pair<Q,Q>& beta) {
38  Q betaImg=beta.second;
39  beta.second=alpha.first*betaImg+alpha.second*beta.first;
40  beta.first=alpha.first*beta.first-alpha.second*betaImg;
41  return beta;
42 
43  }
44 
45  //complex add
46  template<typename Q>
47  inline const std::pair<Q,Q>& add(const std::pair<Q,Q>& alpha,std::pair<Q,Q>& beta) {
48  beta.first+=alpha.first;
49  beta.second+=alpha.second;
50  return beta;
51 
52  }
53 
54 
55 }
56 
57 #endif