From 5b914f85b498c268b4129c289fa51a7009d79e1c Mon Sep 17 00:00:00 2001 From: SatoshiTerasaki Date: Wed, 11 Dec 2024 00:38:42 +0900 Subject: [PATCH] update --- include/sparseir/sve.hpp | 2 +- test/sve.cxx | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/sparseir/sve.hpp b/include/sparseir/sve.hpp index 69980a3..3ac162c 100644 --- a/include/sparseir/sve.hpp +++ b/include/sparseir/sve.hpp @@ -147,9 +147,9 @@ class SamplingSVE : public AbstractSVE { epsilon(epsilon_) { n_gauss = (n_gauss_ > 0) ? n_gauss_ : sve_hints(kernel, epsilon).ngauss(); + // TODO: Implement Rule(n_gauss) rule = convert(legendre(n_gauss)); auto hints = sve_hints(kernel, epsilon); - // TODO: This is not correct, we need to use the segments from the hints nsvals_hint = hints.nsvals(); segs_x = hints.template segments_x(); segs_y = hints.template segments_y(); diff --git a/test/sve.cxx b/test/sve.cxx index 0788565..6f83c10 100644 --- a/test/sve.cxx +++ b/test/sve.cxx @@ -13,8 +13,6 @@ using std::invalid_argument; -using xprec::DDouble; - // Function to check smoothness void check_smooth(const std::function& u, const std::vector& s, double uscale, double fudge_factor) { /* @@ -69,15 +67,20 @@ TEST_CASE("AbstractSVE", "[sve]"){ sparseir::Rule gauss_x = rule.piecewise(segs_x); sparseir::Rule gauss_y = rule.piecewise(segs_y); - sparseir::SamplingSVE sve(lk, 1e-6); - //REQUIRE(true); - // auto sve = sparseir::SamplingSVE(std::make_shared(sparseir::LogisticKernel(10.0)), 1e-6); - // REQUIRE(sve.nsvals_hint == 10); - // REQUIRE(sve.n_gauss == 10); - // REQUIRE(sve.segs_x.size() == 10); - // REQUIRE(sve.segs_y.size() == 10); - // REQUIRE(sve.gauss_x.size() == 10); - // REQUIRE(sve.gauss_y.size() == 10); + auto ssve1 = sparseir::SamplingSVE(lk, 1e-6); + REQUIRE(ssve1.n_gauss == n_gauss); + auto ssve2 = sparseir::SamplingSVE(lk, 1e-6, 12); + REQUIRE(ssve2.n_gauss == 12); + + auto ssve1_double = sparseir::SamplingSVE(lk, 1e-6); + REQUIRE(ssve1_double.n_gauss == n_gauss); + auto ssve2_double = sparseir::SamplingSVE(lk, 1e-6, 12); + REQUIRE(ssve2_double.n_gauss == 12); + + //auto ssve1_ddouble = sparseir::SamplingSVE(lk, 1e-6); + //REQUIRE(ssve1_ddouble.n_gauss == n_gauss); + //auto ssve2_ddouble = sparseir::SamplingSVE(lk, 1e-6, 12); + //REQUIRE(ssve2_ddouble.n_gauss == 12); } TEST_CASE("sve.cpp", "[sve]")