Closed jzzhuang closed 1 year ago
There is a better way to define a generic block from a matrix. @const
is just not designed for it because it creates a new type every time you call it. Please check matblock
for generic gates.
julia> for _ in 1:10
U = matblock(rand(ComplexF64, 4, 4); tag="U")
circuit = chain(2, put((1, 2)=>U))
psi = zero_state(2)
apply!(psi, circuit)
end
It works well! Thank you so much!
I want to sample a random unitary circuit. The desired code is like
The problems of redefining the gate U are summarized here: