TRIQS/triqs_Nevanlinna 4.0.0
A TRIQS application
Loading...
Searching...
No Matches
Nevanlinna_factorization.hpp
1#ifndef TRIQS_NEVANLINNA_NEVANLINNA_FACTORIZATION_HPP
2#define TRIQS_NEVANLINNA_NEVANLINNA_FACTORIZATION_HPP
3
4#include <nda/nda.hpp>
5
6#include <complex>
7
8#include "types.hpp"
9#include "Nevanlinna_error.hpp"
10
11namespace triqs_Nevanlinna {
16 public:
23 void build(nda::vector_const_view<std::complex<double>> mesh, nda::vector_const_view<std::complex<double>> data);
24
32 [[nodiscard]] nda::vector<double> evaluate(nda::vector_const_view<double> grid, double eta = 0.05);
33
39 [[nodiscard]] nda::vector<std::complex<double>>
40 evaluate(nda::vector_const_view<std::complex<double>> grid,
41 nda::vector_const_view<std::complex<double>> theta_M_1 = nda::vector_const_view<std::complex<double>>());
42
43 [[nodiscard]] nda::vector<double> get_Pick_eigenvalues() const {
44 auto M = _data.shape()[0];
45 if (M == 0) { throw Nevanlinna_uninitialized_error("Empty continuation data. Please run solve(...) first."); }
46 //fill the Pick matrix
47 auto Pick = Eigen::MatrixXcd(M, M);
48 for (int i = 0; i < M; i++) {
49 for (int j = 0; j < M; j++) {
50 complex_mpt freq_i = (_mesh(i) - I) / (_mesh(i) + I);
51 complex_mpt freq_j = (_mesh(j) - I) / (_mesh(j) + I);
52 auto val = (One - _data(i) * std::conj(_data(j))) / (One - freq_i * std::conj(freq_j));
53 Pick(i, j) = std::complex<double>(val.real().convert_to<double>(), val.imag().convert_to<double>());
54 }
55 }
56 auto evals = Pick.eigenvalues();
57 auto Pick_eigenvalues = nda::vector<double>(M);
58 std::transform(evals.data(), evals.data() + evals.size(), Pick_eigenvalues.begin(), [](const std::complex<double> &r) { return r.real(); });
59 return Pick_eigenvalues;
60 }
61
62 private:
63 nda::vector<complex_mpt> _phis{};
64 nda::vector<matrix_cplx_mpt> _abcds{};
65 nda::vector<complex_mpt> _mesh{};
66 nda::vector<complex_mpt> _data{};
67 nda::vector<complex_mpt> _grid{};
68 nda::vector<matrix_cplx_mpt> _coeffs{};
69
70 [[nodiscard]] nda::vector<complex_mpt> mobius_trasformation(nda::vector_const_view<std::complex<double>> data) const;
71
72 [[nodiscard]] nda::vector<std::complex<double>> evaluate_for_theta(nda::vector_const_view<std::complex<double>> grid,
73 nda::vector_const_view<std::complex<double>> theta_M_1) const;
74 };
75
76} // namespace triqs_Nevanlinna
77#endif //TRIQS_NEVANLINNA_NEVANLINNA_FACTORIZATION_HPP
void build(nda::vector_const_view< std::complex< double > > mesh, nda::vector_const_view< std::complex< double > > data)
nda::vector< double > evaluate(nda::vector_const_view< double > grid, double eta=0.05)