def states(self, nq=None)->list:
if not nq:
nq = self.num_qubits
st = []
for i in range(2 ** nq):
formStr = '0' + repr(nq) + 'b'
st.append(format(i, formStr))
return st
def ansatz(self, params, wires, state_idx=0)-> None:
state = self.states(nq =self.num_qubits)
for ind_qb, qb in enumerate(list(state[state_idx])):
if qb =='1':
qml.PauliX(wires=wires[ind_qb])
then cost total cost is defined