6b2a79fd202567f1869518efe8b4b68b9d3a3bbf,qiskit/aqua/translators/ising/vertex_cover.py,,sample_most_likely,#Any#Any#,188

Before Change


    Returns:
        numpy.ndarray: binary string as numpy.ndarray of ints.
    
    if isinstance(state_vector, dict) or isinstance(state_vector, OrderedDict):
        // get the binary string with the largest count
        binary_string = sorted(state_vector.items(), key=lambda kv: kv[1])[-1][0]
        x = np.asarray([int(y) for y in list(binary_string)])
        return x
    else:
        n = int(np.log2(state_vector.shape[0]))
        k = np.argmax(np.abs(state_vector))
        x = np.zeros(n)
        for i in range(n):
            x[i] = k % 2
            k >>= 1
        return x


def get_gset_result(x):
    Get graph solution in Gset format from binary string.

    Args:

After Change



def sample_most_likely(n=None, state_vector=None):
    from .common import sample_most_likely as redirect_func
    if n is not None:
        warnings.warn("n argument is not need and it will be removed after Aqua 0.7+",
                      DeprecationWarning)
    warnings.warn("sample_most_likely function has been moved to "
                  "qiskit.aqua.translators.ising.common, "
                  "the method here will be removed after Aqua 0.7+",
                  DeprecationWarning)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 13

Instances


Project Name: Qiskit/qiskit-aqua
Commit Name: 6b2a79fd202567f1869518efe8b4b68b9d3a3bbf
Time: 2019-08-26
Author: chenrich@us.ibm.com
File Name: qiskit/aqua/translators/ising/vertex_cover.py
Class Name:
Method Name: sample_most_likely


Project Name: ContextLab/hypertools
Commit Name: 34782d0323d39bd796aebadf53b8a31ed64f7a8d
Time: 2017-06-04
Author: sucharyan@gmail.com
File Name: hypertools/plot/plot.py
Class Name:
Method Name: plot


Project Name: ContextLab/hypertools
Commit Name: 3b9074719b2c637bdcae9ab6193ad74de14a8121
Time: 2017-06-04
Author: sucharyan@gmail.com
File Name: hypertools/plot/plot.py
Class Name:
Method Name: plot