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

Unable to decompose cat states #64

Open
ColbyDeLisle opened this issue Sep 20, 2024 · 0 comments
Open

Unable to decompose cat states #64

ColbyDeLisle opened this issue Sep 20, 2024 · 0 comments

Comments

@ColbyDeLisle
Copy link
Contributor

ColbyDeLisle commented Sep 20, 2024

I added the following test to decompose.rs, attempting to check the decomposition of |cat_6> found on pg. 6 of this paper:

#[test]
fn cat6() {
    let mut g = Graph::new();

    let mut outputs = vec![];
    let z = g.add_vertex(VType::Z);
    for _ in 0..6 {
        let t = g.add_vertex_with_phase(VType::Z, Rational64::new(1, 4));
        g.add_edge_with_type(z, t, EType::H);

        let out = g.add_vertex(VType::B);
        g.add_edge(t, out);
        outputs.push(out);
    }
    g.set_outputs(outputs);

    let mut d = Decomposer::new(&g);
    d.with_full_simp().save(true).use_cats(true).decomp_all();  // this line panics

    assert_eq!(d.done.len(), 3);
}

Unfortunately the test never makes it to the assert_eq!; instead it panics on the line just prior with the error message "thread 'decompose::tests::cat6' panicked at quizx\src\graph.rs:559:22: Parallel edges only supported between Z and X vertices"

The problem persists when I change 6 to 5. When I change it to 4 the test still doesn't succeed, but instead of panicking it just hangs until I kill the process.

I'm hoping someone can verify that I haven't mistranslated the paper, and maybe has some inkling of where the issue lies. As with the other issue I opened, I'm more than happy to implement a fix if we can arrive at a diagnosis.

(I found this issue while trying to write some unit tests for the Python wrapper. Those unit tests are available on my branch here; I can make a PR to add those tests as well if it would be helpful.)

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

No branches or pull requests

1 participant