Skip to content

Commit

Permalink
Merge pull request #100 from SpM-lab/terasaki/fix-bug-in-postprocess
Browse files Browse the repository at this point in the history
Update `signs = sign_sorted`
  • Loading branch information
terasakisatoshi authored Feb 2, 2025
2 parents 7168002 + 4fbbe07 commit 9dc66cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion include/sparseir/sve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ class CentrosymmSVE : public AbstractSVE<T> {
// Apply the sorted permutation to u_complete, v_complete, signs, and s_merged
std::vector<PiecewiseLegendrePoly> u_sorted(sorted_indices.size());
std::vector<PiecewiseLegendrePoly> v_sorted(sorted_indices.size());
Eigen::VectorX<T> signs_sorted(sorted_indices.size());
Eigen::VectorXi signs_sorted(sorted_indices.size());
Eigen::VectorXd s_sorted(sorted_indices.size());

for (size_t i = 0; i < sorted_indices.size(); ++i) {
Expand All @@ -523,6 +523,8 @@ class CentrosymmSVE : public AbstractSVE<T> {
s_sorted[i] = s_merged[sorted_indices[i]];
signs_sorted[i] = signs[sorted_indices[i]];
}
// Update signs to be the sorted signs
signs = signs_sorted;

auto full_hints = sve_hints<T>(kernel, epsilon);
auto segs_x_vec = full_hints.segments_x();
Expand Down
18 changes: 9 additions & 9 deletions test/basis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ TEST_CASE("FiniteTempBasis consistency tests", "[basis]") {
REQUIRE(sve->v[1].l == 1);
REQUIRE(sve->v[2].l == 2);

//REQUIRE(sve->u[1].symm == 1);
//REQUIRE(sve->u[2].symm == -1);
//REQUIRE(sve->u[3].symm == 1);
//REQUIRE(sve->u[4].symm == -1);

//REQUIRE(sve->v[1].symm == 1);
//REQUIRE(sve->v[2].symm == -1);
//REQUIRE(sve->v[3].symm == 1);
//REQUIRE(sve->v[4].symm == -1);
REQUIRE(sve->u[0].symm == 1);
REQUIRE(sve->u[1].symm == -1);
REQUIRE(sve->u[2].symm == 1);
REQUIRE(sve->u[3].symm == -1);

REQUIRE(sve->v[0].symm == 1);
REQUIRE(sve->v[1].symm == -1);
REQUIRE(sve->v[2].symm == 1);
REQUIRE(sve->v[3].symm == -1);

//std::cout << "Singular values: " << s.transpose() << std::endl;
/*
Expand Down

0 comments on commit 9dc66cb

Please sign in to comment.