diff --git a/WORKSPACE b/WORKSPACE index b88b0d0b0..bbdbfed85 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -67,9 +67,9 @@ http_archive( http_archive( name = "qsim", - sha256 = "e2853379bde52d6277f9be4b80f54d32b3b27f7242a6c561cb34fb12d823b80e", - strip_prefix = "qsim-0.7.1-dev-20210126", - urls = ["https://github.com/quantumlib/qsim/archive/v0.7.1-dev+20210126.zip"], + sha256 = "5bc53d1d8c4689537d6f2cca20a67c8a1488f80a41cc412ca18d54afb6c21648", + strip_prefix = "qsim-0.8.0", + urls = ["https://github.com/quantumlib/qsim/archive/v0.8.0.zip"], ) # Added for crosstool in tensorflow. diff --git a/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc b/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc index 6d444a829..0531d81db 100644 --- a/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc +++ b/tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc @@ -106,19 +106,19 @@ class TfqCalculateUnitaryOp : public tensorflow::OpKernel { // Begin simulation. int largest_nq = 1; - Unitary u = UnitarySpace(largest_nq, tfq_for).CreateUnitary(); + Unitary u = UnitarySpace(tfq_for).CreateUnitary(largest_nq); // Simulate programs one by one. Parallelizing over state vectors // we no longer parallelize over circuits. Each time we encounter a // a larger circuit we will grow the unitary as nescessary. for (int i = 0; i < fused_circuits.size(); i++) { int nq = num_qubits[i]; - UCalculator sim = UCalculator(nq, tfq_for); - UnitarySpace us = UnitarySpace(nq, tfq_for); + UCalculator sim = UCalculator(tfq_for); + UnitarySpace us = UnitarySpace(tfq_for); if (nq > largest_nq) { // need to switch to larger unitaryspace. largest_nq = nq; - u = us.CreateUnitary(); + u = us.CreateUnitary(nq); } us.SetIdentity(u); for (int j = 0; j < fused_circuits[i].size(); j++) { @@ -136,7 +136,7 @@ class TfqCalculateUnitaryOp : public tensorflow::OpKernel { uint64_t k = l % (1 << max_num_qubits); if (k < crossover && j < crossover) { output_tensor(static_cast(i), static_cast(j), - static_cast(k)) = us.GetEntry(u, j, k); + static_cast(k)) = us.GetEntry(u, k, j); } else { output_tensor(static_cast(i), static_cast(j), static_cast(k)) =