-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplexInterpolGSL.h
More file actions
80 lines (64 loc) · 1.3 KB
/
ComplexInterpolGSL.h
File metadata and controls
80 lines (64 loc) · 1.3 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef COMPLEXINTERPOLGSL
#define COMPLEXINTERPOLGSL
#include "InterpolGSL.h"
struct ComplexInterpol
{
ComplexInterpol(){};
ComplexInterpol (Eigen::ArrayXd axis)
{
for (int c=0; c<2; ++c) data[c] = Interpol<GSL>(axis);
}
void insert (int i, complex<double> val)
{
data[0].insert(i, val.real());
data[1].insert(i, val.imag());
};
void operator= (const VectorXcd &V)
{
for (int i=0; i<V.rows(); ++i)
{
data[0].insert(i, V(i).real());
data[1].insert(i, V(i).imag());
}
};
complex<double> integrate()
{
return data[0].integrate() + 1.i * data[1].integrate();
};
complex<double> evaluate (double x)
{
return data[0].evaluate(x) + 1.i * data[1].evaluate(x);
};
double evaluateRe (double x)
{
return data[0].evaluate(x);
};
double evaluateIm (double x)
{
return data[1].evaluate(x);
};
double quick_evaluateRe (double x) const
{
return data[0](x);
};
double quick_evaluateIm (double x) const
{
return data[1](x);
};
complex<double> operator() (double x) const
{
return data[0](x) + 1.i * data[1](x);
}
std::array<Interpol<GSL>,2> data; // array indices: real and imaginary part
void set_splines()
{
data[0].set_splines();
data[1].set_splines();
}
void kill_splines()
{
data[0].kill_splines();
data[1].kill_splines();
}
};
#endif