GTorlai / PastaQ.jl

Package for Simulation, Tomography and Analysis of Quantum Computers
Apache License 2.0
145 stars 23 forks source link

More advanced `appendlayer!` function #137

Open mtfishman opened 4 years ago

mtfishman commented 4 years ago

Currently, appendlayer! works for adding a uniform layer of single qubit gates. It would be nice to have some more advanced features, such as:

The number of qubits of the gate can be determined automatically from Int(log2(size(gate("CX"), 1))). To get more advanced gates, it could accept a function which takes the site and returns a gate, for example:

In general, appendlayer! could accept a range of sites where the 1st qubit of the gate is applied. Additionally, it could accept a vector of arbitrary sites where the 1st qubit is applied (if the pattern is not uniform), as well as reverse ranges.

Functions like randomcircuit and qft could accept ranges and vectors as well, for example:

This can help with using pre-defined circuits as subcircuits of more advanced circuits.