-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspline_me_test.cpp
More file actions
79 lines (54 loc) · 1.84 KB
/
Copy pathspline_me_test.cpp
File metadata and controls
79 lines (54 loc) · 1.84 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
/****************************************************************
spline_me_test.cpp
Mark A. Caprio
University of Notre Dame
****************************************************************/
#include <cmath>
#include <fstream>
#include <iostream>
#include "spline.h"
#include "spline_me.h"
////////////////////////////////////////////////////////////////
// test code
////////////////////////////////////////////////////////////////
struct RadialMonomialParams { int order; };
double RadialMonomialFunction (double r, void * p)
{
RadialMonomialParams* params = static_cast<RadialMonomialParams*>(p);
//auto* radial_monomial_params * params = (struct radial_monomial_params *) p;
double order = (params->order);
return std::pow(r, order);
}
void TestMatrixElement()
{
double me;
std::cout << "Test" << std::endl;
// <0s|r^2|0s>=1.5 Suhonen Table 6.2
// using classic matrix element function for r^n and (ik)^n
me = spline::RadialMatrixElement(
0, 0, 1.0, spline::BasisType::kOscillator,
0, 0, 1.0, spline::BasisType::kOscillator,
spline::OperatorType::kR, 2
);
std::cout << "Using RadialMatrixElement: " << me << std::endl;
// using matrix element function for generic radial function
gsl_function f;
struct RadialMonomialParams params = {2};
f.function = &RadialMonomialFunction;
f.params = & params;
me = spline::RadialMatrixElementOfFunction(
0, 0, 1.0, spline::BasisType::kOscillator,
0, 0, 1.0, spline::BasisType::kOscillator,
spline::OperatorType::kR, &f
);
std::cout << "Using RadialMatrixElementOfFunction: " << me << std::endl;
}
////////////////////////////////////////////////////////////////
// main
////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
TestMatrixElement();
// termination
return 0;
}