1
$\begingroup$

The qml.StronglyEntanglingLayers function works great for what I need. However, I'd like to modify so that for each layer, only the first qubit is the control and the rest are targets of the control per layer. Is there any effective way to do that? Here is my current code.

param_shape = qml.StronglyEntanglingLayers.shape(n_layers=2, n_wires=N_wires)
weights = torch.rand(param_shape)  
    def unitary_random_layers_no_noise(array):
        return qml.StronglyEntanglingLayers(weights=phi_parameterization(array.reshape(param_shape)), wires=range(N_wires))

the reason the function is defined in this way (and that there is no q_node) is because I need the output of the function to be the operator/matrix itself rather than an output statevector from measuring in a particular basis.

If there is a way to get this output given any "manually" constructed ansatz, that would be great. I attempted using qml.matrix for this purpose but was not able to adapt it to get the same output format that my current function does.

Thanks in advance!

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.