mirror of https://github.com/Qiskit/qiskit-aer.git
fix undefined behaviors (#2130)
* fix undefined behaviours * Run clang format 15 instead of 18 * OpenMP for statement must have signed integral type --------- Co-authored-by: Jun Doi <doichan@jp.ibm.com>
This commit is contained in:
parent
322e786b90
commit
e56cbbbd97
|
@ -1775,7 +1775,7 @@ Op input_to_op_bfunc(const inputdata_t &input) {
|
||||||
auto it = comp_table.find(relation);
|
auto it = comp_table.find(relation);
|
||||||
if (it == comp_table.end()) {
|
if (it == comp_table.end()) {
|
||||||
std::stringstream msg;
|
std::stringstream msg;
|
||||||
msg << "Invalid bfunc relation string :\"" << it->first << "\"."
|
msg << "Invalid bfunc relation string :\"" << relation << "\"."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
throw std::invalid_argument(msg.str());
|
throw std::invalid_argument(msg.str());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1323,7 +1323,7 @@ Executor<densmat_t>::sample_measure(const reg_t &qubits, uint_t shots,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Convert to SampleVector format
|
// Convert to SampleVector format
|
||||||
int_t npar = Base::parallel_state_update_;
|
uint_t npar = Base::parallel_state_update_;
|
||||||
if (npar > local_samples.size())
|
if (npar > local_samples.size())
|
||||||
npar = local_samples.size();
|
npar = local_samples.size();
|
||||||
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
|
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ std::vector<SampleVector> State<densmat_t>::sample_measure(const reg_t &qubits,
|
||||||
allbit_samples = BaseState::qreg_.sample_measure(rnds);
|
allbit_samples = BaseState::qreg_.sample_measure(rnds);
|
||||||
|
|
||||||
// Convert to bit format
|
// Convert to bit format
|
||||||
int_t npar = BaseState::threads_;
|
uint_t npar = BaseState::threads_;
|
||||||
if (npar > shots)
|
if (npar > shots)
|
||||||
npar = shots;
|
npar = shots;
|
||||||
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
|
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
|
||||||
|
|
|
@ -259,7 +259,7 @@ protected:
|
||||||
|
|
||||||
// Maximum threads which may be used by the backend for OpenMP multithreading
|
// Maximum threads which may be used by the backend for OpenMP multithreading
|
||||||
// Default value is single-threaded unless overridden
|
// Default value is single-threaded unless overridden
|
||||||
int threads_ = 1;
|
uint_t threads_ = 1;
|
||||||
|
|
||||||
// Set a global phase exp(1j * theta) for the state
|
// Set a global phase exp(1j * theta) for the state
|
||||||
bool has_global_phase_ = false;
|
bool has_global_phase_ = false;
|
||||||
|
|
|
@ -1241,7 +1241,7 @@ Executor<state_t>::sample_measure(const reg_t &qubits, uint_t shots,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Convert to SampleVector format
|
// Convert to SampleVector format
|
||||||
int_t npar = Base::parallel_state_update_;
|
uint_t npar = Base::parallel_state_update_;
|
||||||
if (npar > local_samples.size())
|
if (npar > local_samples.size())
|
||||||
npar = local_samples.size();
|
npar = local_samples.size();
|
||||||
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
|
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
|
||||||
|
|
Loading…
Reference in New Issue