Skip to content

Commit

Permalink
Fix QubitVector::check_dimension to use only the data_size_ field (#2289
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gadial authored Jan 24, 2025
1 parent b3d1aee commit 0bd1716
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/simulators/statevector/qubitvector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,10 @@ void QubitVector<data_t>::check_vector(const cvector_t<data_t> &vec,

template <typename data_t>
void QubitVector<data_t>::check_dimension(const QubitVector &qv) const {
if (data_size_ != qv.size_) {
if (data_size_ != qv.data_size_) {
std::string error = "QubitVector: vectors are different shape " +
std::to_string(data_size_) +
" != " + std::to_string(qv.num_states_);
" != " + std::to_string(qv.data_size_);
throw std::runtime_error(error);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/simulators/statevector/qubitvector_thrust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,10 @@ void QubitVectorThrust<data_t>::check_vector(const cvector_t<data_t> &vec,
template <typename data_t>
void QubitVectorThrust<data_t>::check_dimension(
const QubitVectorThrust &qv) const {
if (data_size_ != qv.size_) {
if (data_size_ != qv.data_size_) {
std::string error = "QubitVectorThrust: vectors are different shape " +
std::to_string(data_size_) +
" != " + std::to_string(qv.num_states_);
" != " + std::to_string(qv.data_size_);
throw std::runtime_error(error);
}
}
Expand Down

0 comments on commit 0bd1716

Please sign in to comment.