In this code i have tried coeffs is an array of [-alpha, -alpha, -alpha, -alpha, - alpha] But I am getting error. Please help me out
n_bits = 5
dev = qml.device("default.qubit", wires=n_bits)
##################
# YOUR CODE HERE #
##################
coeffs = [1,1,1,1,1] # MODIFY THIS
obs = [qml.PauliZ(0),qml.PauliZ(1),qml.PauliZ(2),qml.PauliZ(3),qml.PauliZ(4)] # MODIFY THIS
H = qml.Hamiltonian(coeffs, obs)
@qml.qnode(dev)
def energy(init):
"""Circuit for measuring expectation value of Hamiltonian in a given state.
Args:
init (numpy.array(int)): An initial computational basis state, specified by five bits.
Returns:
float: Expectation value of the Hamiltonian H.
"""
qml.BasisState(init, wires=range(n_bits))
return qml.expval(H)
Code is running very well in Local Compiler but what the coefficient this problem is seeking for I could not understand.