Skip to content
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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Marcogarofalo
Copy link
Contributor

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

if(ngates > 0) {
ipos <- rep(1, times=n)
## plot gates
gatelist <- x@circuit$gatelist
for(i in c(1:ngates)) {
if(max(ipos)%%gate_x_plot==1){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this work here, I don't understand...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

I will have a look to the current version.

@urbach
Copy link
Member

urbach commented Oct 27, 2021

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
Copy link
Member

urbach commented Oct 27, 2021 via email

@Marcogarofalo
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants