Skip to content

Commit 6d2aec8

Browse files
authored
Merge pull request #92 from tnguyen-ornl/tnguyen/fix-itensor-exp-val-z
Fixes for #91
2 parents 7f9fcee + ca6dca8 commit 6d2aec8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tnqvm/visitors/itensor/mps/ITensorMPSVisitor.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,11 @@ void ITensorMPSVisitor::visit(U &u) {
501501
auto ind_in = ind_for_qbit(iqbit_in);
502502
auto ind_out = itensor::Index(u.name(), 2);
503503
auto tGate = itensor::ITensor(ind_in, ind_out);
504-
tGate.set(ind_in(1), ind_out(1), std::cos(theta / 2.0));
505-
tGate.set(ind_in(1), ind_out(2), -std::exp(std::complex<double>(0, lambda)) *
504+
tGate.set(ind_out(1), ind_in(1), std::cos(theta / 2.0));
505+
tGate.set(ind_out(1), ind_in(2), -std::exp(std::complex<double>(0, lambda)) *
506506
std::sin(theta / 2.0));
507-
tGate.set(ind_in(2), ind_out(1), std::exp(std::complex<double>(0, phi)) * std::sin(theta / 2.0));
508-
tGate.set(ind_in(2), ind_out(2), std::exp(std::complex<double>(0, phi + lambda)) *
507+
tGate.set(ind_out(2), ind_in(1), std::exp(std::complex<double>(0, phi)) * std::sin(theta / 2.0));
508+
tGate.set(ind_out(2), ind_in(2), std::exp(std::complex<double>(0, phi + lambda)) *
509509
std::cos(theta / 2.0));
510510
legMats[iqbit_in] = tGate * legMats[iqbit_in];
511511
printWavefunc();

0 commit comments

Comments
 (0)