-
Notifications
You must be signed in to change notification settings - Fork 0
/
k.h
46 lines (38 loc) · 1.6 KB
/
k.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
//
// Created by Kshitij Surjuse on 5/9/23.
//
#ifndef HYLLERAAS_K_H
#define HYLLERAAS_K_H
#include "basis.h"
#include <boost/math/special_functions/factorials.hpp>
#include <boost/math/special_functions/binomial.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace boost::math;
namespace hylleraas {
template<typename intT, typename doubleT>
doubleT K(const intT &n, const intT &l, const intT &m,
const doubleT &alpha, const doubleT &beta, const doubleT &gamma) {
intT one = 1.;
intT two = 2.;
doubleT sixteen = 16.;
const doubleT pi = boost::math::constants::pi<doubleT>();
auto prefactor = sixteen * pow(pi, two) * factorial<doubleT>(n + one)
* factorial<doubleT>(l + one) * factorial<doubleT>(m + one);
doubleT k = 0.0;
for (auto a = 0; a <= n + 1; ++a) {
for (auto b = 0; b <= l + 1; ++b) {
for (auto c = 0; c <= m + 1; ++c) {
auto numerator = binomial_coefficient<doubleT>(l + one - b + a, a)
* binomial_coefficient<doubleT>(m + one - c + b, b)
* binomial_coefficient<doubleT>(n + one - a + c, c);
auto denominator = pow(alpha + beta, l - b + a + two)
* pow(alpha + gamma, n - a + c + two)
* pow(beta + gamma, m - c + b + two);
k += numerator / denominator;
}
}
}
return prefactor * k;
}
}
#endif //HYLLERAAS_K_H