Skip to content

Commit

Permalink
Merge pull request #272 from MichaelBroughton/dagger_fix
Browse files Browse the repository at this point in the history
Fixes incorrect matrix being used in ApplyGateDagger.
  • Loading branch information
95-martin-orion authored Jan 26, 2021
2 parents deffaa5 + 8b57ee2 commit 3824fb2
Show file tree
Hide file tree
Showing 5 changed files with 391 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/gate_appl.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline void ApplyGateDagger(const Simulator& simulator, const Gate& gate,
simulator.ApplyGate(gate.qubits, matrix.data(), state);
} else {
simulator.ApplyControlledGate(gate.qubits, gate.controlled_by,
gate.cmask, gate.matrix.data(), state);
gate.cmask, matrix.data(), state);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions tests/simulator_avx_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ TEST(SimulatorAVXTest, ApplyControlGate) {
TestApplyControlGate<SimulatorAVX<For>>();
}

TEST(SimulatorAVXTest, ApplyControlGateDagger) {
TestApplyControlGateDagger<SimulatorAVX<For>>();
}

TEST(SimulatorAVXTest, MultiQubitGates) {
TestMultiQubitGates<SimulatorAVX<For>>();
}
Expand Down
4 changes: 4 additions & 0 deletions tests/simulator_basic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ TEST(SimulatorBasicTest, ApplyControlGate) {
TestApplyControlGate<SimulatorBasic<For, double>>();
}

TEST(SimulatorBasicTest, ApplyControlGateDagger) {
TestApplyControlGateDagger<SimulatorBasic<For, double>>();
}

TEST(SimulatorBasicTest, MultiQubitGates) {
TestMultiQubitGates<SimulatorBasic<For, double>>();
}
Expand Down
4 changes: 4 additions & 0 deletions tests/simulator_sse_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ TEST(SimulatorSSETest, ApplyControlGate) {
TestApplyControlGate<SimulatorSSE<For>>();
}

TEST(SimulatorSSETest, ApplyControlGateDagger) {
TestApplyControlGateDagger<SimulatorSSE<For>>();
}

TEST(SimulatorSSETest, MultiQubitGates) {
TestMultiQubitGates<SimulatorSSE<For>>();
}
Expand Down
Loading

0 comments on commit 3824fb2

Please sign in to comment.