self._var_form_base, self._operator,
self._optimizer)
// pick maximum gradients and choose that excitation
max_grad = max(cur_grads, key=lambda item: np.abs(item[0]))
if prev_max != () and prev_max[1] == max_grad[1]:
cur_grads_red = [g for g in cur_grads if g[1] != prev_max[1]]
max_grad = max(cur_grads_red, key=lambda item: np.abs(item[0]))
if prev_prev_max != () and prev_prev_max[1] == max_grad[1]:
After Change
and isinstance(self._operator, (WeightedPauliOperator, TPBGroupedWeightedPauliOperator))
self._quantum_instance.circuit_summary = True
cycle_regex = re.compile(r"(.+)( \1)+")
// regex explanation:
// 1. (.+) will match at least one number and try to match as many as possible
// 2. the match of this part is placed into capture group 1
// 3. ( \1)+ will amtch a space followed by the contents of capture group 1