HISKP-LQCD / qsimulatR

GNU Affero General Public License v3.0
9 stars 2 forks source link

split the plot of the circuit when there are too many gates #14

Open Marcogarofalo opened 3 years ago

Marcogarofalo commented 3 years ago

I modify the plot method such that is splitting the plot of the circuit into multiple lines. The maximum number of gates per plot is set by default to 12 but it can passed as a parameter. Here there are some examples test_plot.pdf

urbach commented 2 years ago

I have also fixed the problem of overlapping single- and multi-qubit gates. This is somehow incompatible with what you did, but I don't understand what you did. When using this interactively it also does not create a single plot?

urbach commented 2 years ago

@Marcogarofalo commented on this pull request.

         if(ngates > 0) {

ipos <- rep(1, times=n)

plot gates

gatelist <- @.***$gatelist for(i in c(1:ngates)) {

  • if(max(ipos)%%gate_x_plot==1){

the name is misleading, gate_x_plot is the number of columns per plot. Since you can have many gates on the same column.

but how are the several column plots triggered?

In the new master I compute the x-pos for each gate once at the beginning gpos. We could add a y-pos also. Then, one could prepare everything in a single plot.

Marcogarofalo commented 2 years ago

before I was counting the colum with ipos, that was updated for a single qubit gates as

ipos[gatelist[[i]]$bits[1]] <- ipos[gatelist[[i]]$bits[1]] + 1

or for multiple qubit state as

ipos[1:n] <- xp + 1 

so at every iteration of the loop for(i in c(1:ngates)) I was checking the maximum of the ipos entry, if if(max(ipos)%%gate_x_plot==1) I create a new plot.