Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ryanlevy
Copy link

Addressing #219 and this forum post, this provides a concatenation function for local operators and AutoMPO

Usage:

auto ampo = AutoMPO(sites);

//loop in a function
for(auto n: range1(N))
   ampo.concat("Sz",n);
ampo.combine(); //done concating, does the += step

//For coefficients and a function
Real J = -1.7;
//same as ampo += J,"Sz",1,"Sz",2,"Sz",3;
ampo.concat(J);
for(auto n: range1(3))
    ampo.concat("Sz",n);
ampo.combine();

//don't like the comma operator? This works too
//same as ampo += 3.14,"Nup",2,"Ndn",4,"Nupdn",7";
ampo.concat(3.14,"Nup",2)
    .concat("Ndn",4,"Nupdn",7) //takes any number of arguments
    .combine();

Caveat: only one concat sequence is allowed at a time.

I'm not 100% in love with the names, so please feel free to suggest alternatives.

@dkweiss31
Copy link

Thank you!

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