I recently encountered an error when running a fairly large circuit (2 photons, 20 modes):
‘All parameters must be defined to compute numeric unitary matrix’ Job status = ERROR
There are no details on the exact error (the error type is NONE I believe)
It seems like something went wrong in the decomposition of the unitary matrix I am giving to the circuit.
What I am doing here is use the internal decomposition tool of Perceval to calculate the circuit with this:
where U is a random unitary, U=pcvl.Matrix.random_unitary(20). It tells me the difference between the original unitary and the computed unitary is ~10^-8, so not perfect but pretty good.
I also saw that I am getting different values for the BS and PS from the decomposition every time I run it (which I find a bit odd). I see that as the error above changes slightly from run to run using the same random unitary (but the error always stays on the same order of magnitude).
I did nothing too fancy, just following your tutorials and copying different parts of it together.
Any idea what the problem might be and how to avoid it in the future?
About the decomposition, if you are using random unitary, it’s normal that your target circuit changes every time. Also, the decomposition needs to solve equations and start from random points for that, so you should expect different results every time you run it. You can use pcvl.random_seed(0) to set the seed, which should always give you the same results.
For your error, I don’t know what you are trying to do. Can you provide a small sample of code that reproduces your error?
Thanks for your quick reply.
I run everything in a jupyter notebook, so although the unitary is random, I don’t recreate it every time I do a decomposition. So it is the same random unitary every time. I do get the point with the random seed though. I’m not sure how you calculate the decomposition, but from memory I remember there being an arbitrary phase matrix, I just figured that would be the same every time and not randomly seeded.
I currently don’t have access to my code unfortunately, will get back to you with that early next week. Overall though I am just decomposing a random 20x20 unitary and sending the circuit to the cloud with some input state of two photons, e.g. [1,1,0,0,…,0].