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

Error in expect' #201

Closed
artix41 opened this issue Sep 23, 2019 · 3 comments
Closed

Error in expect' #201

artix41 opened this issue Sep 23, 2019 · 3 comments

Comments

@artix41
Copy link

artix41 commented Sep 23, 2019

I'm trying to run this code

v_unitary = variational_circuit(n)
v_circuit = chain(n+1, control(1, 2:n+1=>v_unitary));
expect'(put(n+1, 1=>Z), zero_state(n+1) => v_circuit)

but get the following error:

MethodError: no method matching dynamicize(::Array{Int64,1})

Note that the following code is working:

v_unitary = chain(n, repeat(H, 1:n))
v_circuit = chain(n+1, control(1, 2:n+1=>v_unitary));
expect'(put(n+1, 1=>Z), zero_state(n+1) => v_circuit)
Roger-luo added a commit to QuantumBFS/LuxurySparse.jl that referenced this issue Sep 23, 2019
@Roger-luo
Copy link
Member

I can't reproduce the error on my laptop, but it seems to be fixed in LuxurySparse now.

@Roger-luo
Copy link
Member

OK, I did a bit investigation, this is error is triggered by control gate on a matrix representation. This should be fixed by the patch in LuxurySparse.

@GiggleLiu
Copy link
Member

GiggleLiu commented Sep 24, 2019

Yeah, this is a bug, with the master branch of LuxurySparse, it should work now.
(By typing ] dev LuxurySparse in a Julia REPL).

Now the performance of controlled large block is not fully optimized, it calls into the matrix representation of target block, which will cause allocations. use cache to avoided invoking mat multiple times

v_circuit = chain(n+1, control(1, 2:n+1=>cache(v_unitary)));

please let us know if you want it be more performant.

@artix41

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

3 participants