Skip to content

Commit

Permalink
Merge pull request #92 from tnguyen-ornl/tnguyen/fix-itensor-exp-val-z
Browse files Browse the repository at this point in the history
Fixes for #91
  • Loading branch information
1tnguyen authored Feb 9, 2021
2 parents 7f9fcee + ca6dca8 commit 6d2aec8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tnqvm/visitors/itensor/mps/ITensorMPSVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,11 @@ void ITensorMPSVisitor::visit(U &u) {
auto ind_in = ind_for_qbit(iqbit_in);
auto ind_out = itensor::Index(u.name(), 2);
auto tGate = itensor::ITensor(ind_in, ind_out);
tGate.set(ind_in(1), ind_out(1), std::cos(theta / 2.0));
tGate.set(ind_in(1), ind_out(2), -std::exp(std::complex<double>(0, lambda)) *
tGate.set(ind_out(1), ind_in(1), std::cos(theta / 2.0));
tGate.set(ind_out(1), ind_in(2), -std::exp(std::complex<double>(0, lambda)) *
std::sin(theta / 2.0));
tGate.set(ind_in(2), ind_out(1), std::exp(std::complex<double>(0, phi)) * std::sin(theta / 2.0));
tGate.set(ind_in(2), ind_out(2), std::exp(std::complex<double>(0, phi + lambda)) *
tGate.set(ind_out(2), ind_in(1), std::exp(std::complex<double>(0, phi)) * std::sin(theta / 2.0));
tGate.set(ind_out(2), ind_in(2), std::exp(std::complex<double>(0, phi + lambda)) *
std::cos(theta / 2.0));
legMats[iqbit_in] = tGate * legMats[iqbit_in];
printWavefunc();
Expand Down

0 comments on commit 6d2aec8

Please sign in to comment.