Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust fundamental operator set to respect order in gf_struct #342 #686

Merged
merged 4 commits into from
Mar 8, 2019

Conversation

Wentzell
Copy link
Member

@Wentzell Wentzell commented Mar 6, 2019

In accordance with the type-change of gf_struct_t to

gf_struct_t = vector<pair<int,vector<indices_t>>>

that was introduced in a746ba5 this commit adjusts the
fundamental_operator_set to respect the order of blocks in gf_struct

This PR still contains unfixed test failures for the atom_diag part of triqs.

@krivenko Could you comment on/review this PR and have a look at the test failures in atom_diag?

-In acc with the type gf_struct_t=vector<pair<int,vec<int/str>>>
that describes the Block Green function structure
this commit adjusts the fundamental operator set to respect this
block-order
-Contains unfixed test failures for atom_diag
@krivenko
Copy link
Contributor

krivenko commented Mar 6, 2019

I'll look at the code a bit later...

Now I only have a quick question about gf_struct_t.
The commit message of a746ba5 states that gf_struct_t = vector<pair<string,vector<indices_t>>>. Who is to believe?

@Wentzell
Copy link
Member Author

Wentzell commented Mar 6, 2019

You are indeed correct. The type is vector<pair<string,vector<indices_t>>>

Copy link
Contributor

@krivenko krivenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only a couple of small remarks.
Besides, I fixed the test failures in krivenko@b84c865.


/// The set represented as a plain `std::vector`
/// The basic container `std::vector<indices_t>`
using reduction_t = std::vector<indices_t>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that fundamental_operator_set is just a vector with some convenience methods, I'd rather rename this type to data_t or something similar.

}

// Dereference type for const_iterator
struct _cdress {
indices_t const &index;
int linear_index;
_cdress(typename map_t::const_iterator _it) : index(_it->first), linear_index(_it->second) {}
using base_const_iterator = triqs::utility::details::enum_iter<reduction_t::const_iterator>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drawing things from details namespace is not what one should be doing. Consider moving enum_iter into triqs::utility.

krivenko and others added 2 commits March 7, 2019 16:24
…_operator_set

`fundamental_operator_set` used to store operator index combinations in
the lexicographical order. Now they are stored in the order they were
inserted.
@Wentzell
Copy link
Member Author

Wentzell commented Mar 7, 2019

Hey @krivenko
Thank you for the test fixes and comments.
I have addressed them in 985898d

Let me know if we can merge it like this.

@krivenko
Copy link
Contributor

krivenko commented Mar 7, 2019

LGTM, thank you!

@Wentzell Wentzell merged commit 3bfdfc0 into TRIQS:unstable Mar 8, 2019
@Wentzell Wentzell deleted the PR_FOPS_ORDER branch March 8, 2019 17:15
krivenko added a commit to krivenko/triqs that referenced this pull request Aug 30, 2021
PR TRIQS#686 changed the order in which `fundamental_operator_set` stores
index combinations. Before that PR, mutual order of two index combinations
was dictated by the result of `operator<()`, which had been consistent with
the way `many_body_operator` orders canonical operators within a monomial.
Now the order of the index combinations and - consequently - of single
particle bits forming a Fock state is arbitrary. When computing fermionic
sign prefactor, the constructor of `imperative_operator` relied on ordering
of the bits being consistent with the ordering of the monomial. PR TRIQS#686
broke that assumption, which resulted in a dangerous and hard-to-find
bug -- sign of some matrix elements can be erroneously flipped.

This commit fixes the issue by sorting monomials in `imperative_operator`'s
constructor and revealing a possible sign change due to a permutation of
canonical operators caused by `fops`.
Wentzell pushed a commit that referenced this pull request Sep 9, 2021
PR #686 changed the order in which `fundamental_operator_set` stores
index combinations. Before that PR, mutual order of two index combinations
was dictated by the result of `operator<()`, which had been consistent with
the way `many_body_operator` orders canonical operators within a monomial.
Now the order of the index combinations and - consequently - of single
particle bits forming a Fock state is arbitrary. When computing fermionic
sign prefactor, the constructor of `imperative_operator` relied on ordering
of the bits being consistent with the ordering of the monomial. PR #686
broke that assumption, which resulted in a dangerous and hard-to-find
bug -- sign of some matrix elements can be erroneously flipped.

This commit fixes the issue by sorting monomials in `imperative_operator`'s
constructor and revealing a possible sign change due to a permutation of
canonical operators caused by `fops`.
Wentzell pushed a commit that referenced this pull request Sep 9, 2021
PR #686 changed the order in which `fundamental_operator_set` stores
index combinations. Before that PR, mutual order of two index combinations
was dictated by the result of `operator<()`, which had been consistent with
the way `many_body_operator` orders canonical operators within a monomial.
Now the order of the index combinations and - consequently - of single
particle bits forming a Fock state is arbitrary. When computing fermionic
sign prefactor, the constructor of `imperative_operator` relied on ordering
of the bits being consistent with the ordering of the monomial. PR #686
broke that assumption, which resulted in a dangerous and hard-to-find
bug -- sign of some matrix elements can be erroneously flipped.

This commit fixes the issue by sorting monomials in `imperative_operator`'s
constructor and revealing a possible sign change due to a permutation of
canonical operators caused by `fops`.
Wentzell pushed a commit that referenced this pull request Sep 9, 2021
PR #686 changed the order in which `fundamental_operator_set` stores
index combinations. Before that PR, mutual order of two index combinations
was dictated by the result of `operator<()`, which had been consistent with
the way `many_body_operator` orders canonical operators within a monomial.
Now the order of the index combinations and - consequently - of single
particle bits forming a Fock state is arbitrary. When computing fermionic
sign prefactor, the constructor of `imperative_operator` relied on ordering
of the bits being consistent with the ordering of the monomial. PR #686
broke that assumption, which resulted in a dangerous and hard-to-find
bug -- sign of some matrix elements can be erroneously flipped.

This commit fixes the issue by sorting monomials in `imperative_operator`'s
constructor and revealing a possible sign change due to a permutation of
canonical operators caused by `fops`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants