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

Removed some code that is never executed and an unused parameter #2314

Merged
merged 2 commits into from
Feb 9, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ std::vector<SampleVector> State::sample_measure_all(uint_t shots,

#pragma omp parallel for if (getenv("PRL_PROB_MEAS"))
for (int_t i = 0; i < static_cast<int_t>(shots); i++) {
auto single_result = qreg_.sample_measure(shots, rng);
auto single_result = qreg_.sample_measure(rng);
all_samples[i].from_vector(single_result);
}
return all_samples;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ reg_t MPS::sort_measured_values(const reg_t &input_outcome,
// probability. We then update 'mat' by contracting it with the suitable
// matrix (0 or 1).

reg_t MPS::sample_measure(uint_t shots, RngEngine &rng) const {
reg_t MPS::sample_measure(RngEngine &rng) const {
double prob = 1;
reg_t current_measure(num_qubits_);
cmatrix_t mat;
Expand Down Expand Up @@ -1683,10 +1683,6 @@ uint_t MPS::sample_measure_single_qubit(uint_t qubit, double &prob, double rnd,
// measurement outcome
if (qubit == 0) {
mat = q_reg_[qubit].get_data(measurement);
if (qubit != 0) // multiply mat by left lambda
for (uint_t col = 0; col < mat.GetColumns(); col++)
for (uint_t row = 0; row < mat.GetRows(); row++)
mat(row, col) *= lambda_reg_[qubit - 1][row];
} else {
mat = mat * q_reg_[qubit].get_data(measurement);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class MPS {

reg_t apply_measure(const reg_t &qubits, const rvector_t &rnds);
reg_t apply_measure_internal(const reg_t &qubits, const rvector_t &rands);
reg_t sample_measure(uint_t shots, RngEngine &rng) const;
reg_t sample_measure(RngEngine &rng) const;

//----------------------------------------------------------------
// Function name: initialize_from_statevector_internal
Expand Down