qiboteam / qibo

A framework for quantum computing
https://qibo.science
Apache License 2.0
279 stars 56 forks source link

Computing circuit matrices. #385

Closed igres26 closed 1 year ago

igres26 commented 3 years ago

As discussed in yesterdays meeting. It would be interesting to have an automatic way to transform a circuit, as in a sequence of gates applied to a quantum state, into its full matrix form.

Of course, this will only be possible for relatively few qubits, but can be interesting to see the full effect, of a circuit onto a quantum state.

This could be implemented with something like:

c = Circuit(nqubits) c.add(gates....) matrix_form = c.matrix()

I think this could be useful in some cases.

Additionally, but not as pressing, if parametrized gates can be processed this way via symbols, it might help to further understand variational algorithms and the role of extra layers on initial parameters.

renatomello commented 1 year ago

This was solved by Circuit.unitary(), right @igres26?