From 61b50b121e422e246433860bd2208f6da132cf51 Mon Sep 17 00:00:00 2001 From: Glacialte Date: Thu, 18 Jan 2024 07:26:33 +0000 Subject: [PATCH] fix some --- qulacs/gate/gate_npair_qubit.hpp | 2 +- qulacs/gate/update_ops_npair_qubit.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qulacs/gate/gate_npair_qubit.hpp b/qulacs/gate/gate_npair_qubit.hpp index 2f8f3f14..567b689e 100644 --- a/qulacs/gate/gate_npair_qubit.hpp +++ b/qulacs/gate/gate_npair_qubit.hpp @@ -13,7 +13,7 @@ class FusedSWAP : public QuantumGate { : qubit_index1(_qubit_index1), qubit_index2(_qubit_index2), block_size(_block_size) { UINT upper_index = std::max(_qubit_index1, _qubit_index2); UINT lower_index = std::min(_qubit_index1, _qubit_index2); - if (upper_index > (lower_index + block_size - 1)) { + if (upper_index <= (lower_index + block_size - 1)) { throw std::runtime_error( "FusedSwap: upper index must be bigger than lower_index + block_size - 1"); } diff --git a/qulacs/gate/update_ops_npair_qubit.cpp b/qulacs/gate/update_ops_npair_qubit.cpp index f1f1a3ac..869b00b7 100644 --- a/qulacs/gate/update_ops_npair_qubit.cpp +++ b/qulacs/gate/update_ops_npair_qubit.cpp @@ -14,7 +14,7 @@ void fusedswap_gate(UINT target_qubit_index_0, UINT upper_index, lower_index; upper_index = std::max(target_qubit_index_0, target_qubit_index_1); lower_index = std::min(target_qubit_index_0, target_qubit_index_1); - if (n_qubits > (upper_index + block_size - 1)) { + if (n_qubits <= (upper_index + block_size - 1)) { throw std::runtime_error( "FusedSwap: num of qubits must be bigger than upper_index + block_size - 1"); }