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

Fixes in qubitvector #126

Merged
merged 5 commits into from
Apr 5, 2019
Merged

Conversation

chriseclectic
Copy link
Member

Summary

Adds several fixes to QubitVector class:

  • apply_matrix checks if matrix is single-qubit and if so uses optimized function
  • single qubit apply_matrix checks if matrix is diagonal and if so uses optimized function
  • fixes bug in apply_matrix2 using row-major order instead of col-major order for matrix
  • fixes indexes of lambda function to be const ref instead of copy (which is bad for the unique pointer objects returned by the indexes function and only worked when it could use move-semantics).

Details and comments

@chriseclectic chriseclectic requested a review from hhorii April 5, 2019 15:56
@chriseclectic chriseclectic requested a review from atilag as a code owner April 5, 2019 15:56
if (mat[1] == 0.0 && mat[2] == 0.0) {
const cvector_t diag = {{mat[0], mat[3]}};
apply_diagonal_matrix(qubit, diag);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need return; here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

@chriseclectic chriseclectic merged commit ccad03f into Qiskit:master Apr 5, 2019
@chriseclectic chriseclectic deleted the patch-apply-matrix branch April 30, 2019 20:12
dcmckayibm pushed a commit to dcmckayibm/qiskit-aer that referenced this pull request Nov 3, 2019
* fix apply_matrix2 vectorization order

* add check if 1-qubit mat in apply_matrix

* fix indexes lambda functions

* add qubit checks for apply_matrix2 etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants