Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
terasakisatoshi committed Dec 10, 2024
1 parent 9afd981 commit 5b914f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/sparseir/sve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ class SamplingSVE : public AbstractSVE<K, T> {
epsilon(epsilon_)
{
n_gauss = (n_gauss_ > 0) ? n_gauss_ : sve_hints(kernel, epsilon).ngauss();
// TODO: Implement Rule<T>(n_gauss)
rule = convert<T>(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<T>();
segs_y = hints.template segments_y<T>();
Expand Down
25 changes: 14 additions & 11 deletions test/sve.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

using std::invalid_argument;

using xprec::DDouble;

// Function to check smoothness
void check_smooth(const std::function<double(double)>& u, const std::vector<double>& s, double uscale, double fudge_factor) {
/*
Expand Down Expand Up @@ -69,15 +67,20 @@ TEST_CASE("AbstractSVE", "[sve]"){

sparseir::Rule<double> gauss_x = rule.piecewise(segs_x);
sparseir::Rule<double> gauss_y = rule.piecewise(segs_y);
sparseir::SamplingSVE<sparseir::LogisticKernel, double> sve(lk, 1e-6);
//REQUIRE(true);
// auto sve = sparseir::SamplingSVE<sparseir::LogisticKernel, double>(std::make_shared<sparseir::LogisticKernel>(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<sparseir::LogisticKernel>(lk, 1e-6);
REQUIRE(ssve1.n_gauss == n_gauss);
auto ssve2 = sparseir::SamplingSVE<sparseir::LogisticKernel>(lk, 1e-6, 12);
REQUIRE(ssve2.n_gauss == 12);

auto ssve1_double = sparseir::SamplingSVE<sparseir::LogisticKernel, double>(lk, 1e-6);
REQUIRE(ssve1_double.n_gauss == n_gauss);
auto ssve2_double = sparseir::SamplingSVE<sparseir::LogisticKernel, double>(lk, 1e-6, 12);
REQUIRE(ssve2_double.n_gauss == 12);

//auto ssve1_ddouble = sparseir::SamplingSVE<sparseir::LogisticKernel, xprec::DDouble>(lk, 1e-6);
//REQUIRE(ssve1_ddouble.n_gauss == n_gauss);
//auto ssve2_ddouble = sparseir::SamplingSVE<sparseir::LogisticKernel, xprec::DDouble>(lk, 1e-6, 12);
//REQUIRE(ssve2_ddouble.n_gauss == 12);
}

TEST_CASE("sve.cpp", "[sve]")
Expand Down

0 comments on commit 5b914f8

Please sign in to comment.