Skip to content

Commit

Permalink
fix gate_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Glacialte committed Dec 12, 2023
1 parent 50ad252 commit 00ddd35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/gate/gate_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ void run_random_gate_apply(UINT n_qubits,
double theta = M_PI * random.uniform();
double phi = M_PI * random.uniform();
double lambda = M_PI * random.uniform();
if (typeid(QuantumGateConstructor) == typeid(U1)) {
if (contexpr(std::is_same_v<QuantumGateConstructor, U1>)) {
theta = 0;
phi = 0;
} else if (typeid(QuantumGateConstructor) == typeid(U2)) {
} else if (contexpr(std::is_same_v<QuantumGateConstructor, U2>)) {
theta = M_PI / 2;
} else if (typeid(QuantumGateConstructor) == typeid(U3)) {
} else if (contexpr(std::is_same_v<QuantumGateConstructor, U3>)) {
} else {
throw std::runtime_error("Invalid gate type");
}
Expand Down

0 comments on commit 00ddd35

Please sign in to comment.