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

Refactor and improve fusion #255

Merged
merged 9 commits into from
Jul 3, 2019
Merged

Conversation

hhorii
Copy link
Collaborator

@hhorii hhorii commented Jun 26, 2019

Summary

This PR refactors and improves fusion optimization.

Details and comments

Transpile::Fusion generates a matrix. matrix_sequence is deprecated from OpType.
QV::QubitVector specializes some 2qubit operations with matrixes.

src/base/controller.hpp Show resolved Hide resolved
src/framework/operations.hpp Outdated Show resolved Hide resolved
src/framework/operations.hpp Outdated Show resolved Hide resolved
src/framework/operations.hpp Outdated Show resolved Hide resolved
src/framework/utils.hpp Outdated Show resolved Hide resolved
src/framework/utils.hpp Outdated Show resolved Hide resolved
Copy link
Member

@atilag atilag left a comment

Choose a reason for hiding this comment

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

LGTM!
Left some comments related to styling though

src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
@@ -29,7 +29,7 @@ using reg_t = std::vector<uint_t>;

class Fusion : public CircuitOptimization {
Copy link
Member

Choose a reason for hiding this comment

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

We need some code documentation here.
What is Fusion?

Copy link
Member

Choose a reason for hiding this comment

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

In general, we have to document every method in this class

src/transpile/fusion.hpp Outdated Show resolved Hide resolved
src/transpile/fusion.hpp Outdated Show resolved Hide resolved
src/transpile/fusion.hpp Show resolved Hide resolved
@@ -510,6 +510,15 @@ std::vector<T> vectorize_matrix(const matrix<T>& mat) {
return vec;
}

template<class T>
std::vector<T> vectorize_diagonal_matrix(const matrix<T>& mat) {
Copy link
Member

@chriseclectic chriseclectic Jul 3, 2019

Choose a reason for hiding this comment

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

This function actually just extracts the diagonal from a square matrix, so maybe we should call it matrix_diagonal. I won't let it block this PR though, I can rename in cu1 gates PR.

@chriseclectic chriseclectic merged commit a5e3aa2 into Qiskit:master Jul 3, 2019
dcmckayibm pushed a commit to dcmckayibm/qiskit-aer that referenced this pull request Nov 3, 2019
* refactor fusion by deleting matrix_sequence and fix bugs in mcu in qubitvector.

* CH supports nop

* specialize u1 and cu1 fusion

* refactor fusion-related codes

* remove nop operation type
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.

3 participants