-
Notifications
You must be signed in to change notification settings - Fork 368
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
Conversation
There was a problem hiding this 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
@@ -29,7 +29,7 @@ using reg_t = std::vector<uint_t>; | |||
|
|||
class Fusion : public CircuitOptimization { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
@@ -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) { |
There was a problem hiding this comment.
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.
* 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
Summary
This PR refactors and improves fusion optimization.
Details and comments
Transpile::Fusion
generates a matrix.matrix_sequence
is deprecated fromOpType
.QV::QubitVector
specializes some 2qubit operations with matrixes.