Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix undefined behaviors #2130

Merged
merged 7 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/framework/operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ Op input_to_op_bfunc(const inputdata_t &input) {
auto it = comp_table.find(relation);
if (it == comp_table.end()) {
std::stringstream msg;
msg << "Invalid bfunc relation string :\"" << it->first << "\"."
msg << "Invalid bfunc relation string :\"" << relation << "\"."
<< std::endl;
throw std::invalid_argument(msg.str());
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/density_matrix/densitymatrix_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ Executor<densmat_t>::sample_measure(const reg_t &qubits, uint_t shots,
#endif

// Convert to SampleVector format
int_t npar = Base::parallel_state_update_;
uint_t npar = Base::parallel_state_update_;
if (npar > local_samples.size())
npar = local_samples.size();
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/density_matrix/densitymatrix_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ std::vector<SampleVector> State<densmat_t>::sample_measure(const reg_t &qubits,
allbit_samples = BaseState::qreg_.sample_measure(rnds);

// Convert to bit format
int_t npar = BaseState::threads_;
uint_t npar = BaseState::threads_;
if (npar > shots)
npar = shots;
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class Base {

// Maximum threads which may be used by the backend for OpenMP multithreading
// Default value is single-threaded unless overridden
int threads_ = 1;
uint_t threads_ = 1;

// Set a global phase exp(1j * theta) for the state
bool has_global_phase_ = false;
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/statevector/statevector_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ Executor<state_t>::sample_measure(const reg_t &qubits, uint_t shots,
#endif

// Convert to SampleVector format
int_t npar = Base::parallel_state_update_;
uint_t npar = Base::parallel_state_update_;
if (npar > local_samples.size())
npar = local_samples.size();
std::vector<SampleVector> all_samples(shots, SampleVector(qubits.size()));
Expand Down
Loading