b51789878359e051338c91b8f1f0a916a1e6e65b,qiskit/aqua/algorithms/adaptive/vqe_adapt/vqe_adapt.py,VQEAdapt,_run,#VQEAdapt#,119

Before Change


                                                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


        // -> this results in any number of repeating numbers being detected

        threshold_satisfied = False
        prev_op_indices = []
        theta = []
        iteration = 0
        while not threshold_satisfied:
            iteration += 1
            logger.info("--- Iteration //%s ---", str(iteration))
            // compute gradients
            cur_grads = self._compute_gradients(self._excitation_pool, theta, self._delta,
                                                self._var_form_base, self._operator,
                                                self._optimizer)
            // pick maximum gradients and choose that excitation
            max_grad_index, max_grad = max(enumerate(cur_grads),
                                           key=lambda item: np.abs(item[1][0]))
            prev_op_indices.append(max_grad_index)
            // check indices of picked gradients for cycles
            if cycle_regex.search(" ".join(map(str, prev_op_indices))) is not None:
                logger.info("Alternating sequence found. Finishing.")
                logger.info("Final maximum gradient: %s", str(np.abs(max_grad[0])))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: Qiskit/qiskit-aqua
Commit Name: b51789878359e051338c91b8f1f0a916a1e6e65b
Time: 2019-09-22
Author: rmax@ethz.ch
File Name: qiskit/aqua/algorithms/adaptive/vqe_adapt/vqe_adapt.py
Class Name: VQEAdapt
Method Name: _run


Project Name: kymatio/kymatio
Commit Name: 83cd239880d245c6e4eb4178839cb93385a97014
Time: 2018-11-21
Author: janden@flatironinstitute.org
File Name: scattering/scattering1d/filter_bank.py
Class Name:
Method Name: compute_params_filterbank


Project Name: biocore/scikit-bio
Commit Name: 25ba1b21813a346b303adf045b88803d70ed90fe
Time: 2015-11-30
Author: mcdonadt@colorado.edu
File Name: skbio/tree/_tree.py
Class Name: TreeNode
Method Name: _set_max_distance


Project Name: automl/SMAC3
Commit Name: 1d26befe8bbce37743e6d513993f150772fabe87
Time: 2016-03-09
Author: lindauer@informatik.uni-freiburg.de
File Name: examples/rf.py
Class Name:
Method Name: rfr