1#ifndef CHEMMISOL_ARITHMETICS_H
2#define CHEMMISOL_ARITHMETICS_H
10 constexpr double pi = 3.141592653589793238462643383279502884;
13 std::list<std::complex<T>> unit_roots(
int n) {
14 std::list<std::complex<T>> r;
15 std::complex<T> single_root = {
20 for(
int i = 0; i < n; i++) {
21 r.push_back(std::pow(single_root, i));
27 std::list<std::complex<T>> roots(
const std::complex<T>& c,
int n) {
28 std::list<std::complex<T>> r;
29 T theta = std::arg(c);
30 std::complex<T> single_root =
31 std::polar(std::pow(std::abs(c), T(1.0)/n), theta/n);
32 auto units = unit_roots<T>(n);
33 for(
auto unit : units) {
34 r.push_back(single_root * unit);
Definition chemmisol.h:31