#include "kpm.h"

#include "base/consts.h"

namespace tbplas::tbpm {
using tbplas::base::complex_t;

void jackson_kernel(Eigen::VectorXd& kernel)
{
    size_t num_kernel = kernel.size();
    auto denom = static_cast<double>(num_kernel + 1);
    double theta = tbplas::base::PI / denom;
    double cot_theta = std::cos(theta) / std::sin(theta);
    kernel[0] = 1.0;
#pragma omp parallel for simd
    for (int n = 1; n < num_kernel; ++n) {
        kernel[n] = ((denom - n) * std::cos(theta * n) + cot_theta * std::sin(theta * n)) / denom;
    }
}

} // namespace tbplas::tbpm