Closed aromanro closed 1 month ago
I think it is not necessary to add all the gates we have on statevector simulator to others, but we can run the circuit by using transpiler
That is indeed a solution... my problem is that I'm using it from a c++ project and that would mean adding more complexity to it and dependency on code that might change (also I'm not sure if the transpiler is fully implemented in qiskit aer in c++... or in qiskit with some python code mixed in).
Supporting more gates in a particular simulator - and having a larger common set supported by them - seems not a bad ideea, anyway.
I found a workaround that's enough for me:
It appears that apply_unitary and apply_diagonal_matrix should work at least for one and two-qubit gates (the three qubit ones I need I can transpile to one and two-qubit gates circuits).
For the gates that are not supported I can provide myself the matrices to those calls.
I'm closing this as solved since this solves it for me... although still supporting a larger common set of gates would be nice.
What is the expected behavior?
I expected it to support all gates (at least one and two qubit ones) that the statevector supports, probably having this wouldn't be so difficult (especially for one qubit gates, where there is an
apply_matrix
function for the qubit's tensor).For two qubit gates there seems that the function
apply_2_qubit_gate
is able to apply a generic gate matrix, if this is true it shouldn't be so difficult to add all the two qubit gates that are supported by statevector implementation.How I found out about this:
I tried to compare the results (and the speed, as I expect that my generic simple 'tutorial' implementation to be much slower) with my implementation of MPS with some more or less random circuits and the tests failed with something like:
If needed, I could try to add those myself, although probably there wouldn't be any optimisation that might be possible for some gates, since I'm not familiar enough with the implementation.