8daace20a97c65f845ed008f4b60bdc62b12e250,gensim/matutils.py,,unitvec,#Any#Any#Any#,669

Before Change


            if return_norm:
                return vec / veclen, veclen
            else:
                return vec / veclen
        else:
            if return_norm:
                return vec, 1.
            else:

After Change


            veclen = np.sqrt(np.sum(vec.data ** 2))
        if veclen > 0.0:
            if np.issubdtype(vec.dtype, np.int):
                vec = vec.astype(np.float)
            vec /= veclen
            if return_norm:
                return vec, veclen
            else:
                return vec
        else:
            if return_norm:
                return vec, 1.
            else:
                return vec

    if isinstance(vec, np.ndarray):
        if norm == "l1":
            veclen = np.sum(np.abs(vec))
        if norm == "l2":
            veclen = blas_nrm2(vec)
        if veclen > 0.0:
            if np.issubdtype(vec.dtype, np.int):
                vec = vec.astype(np.float)
            if return_norm:
                return blas_scal(1.0 / veclen, vec).astype(vec.dtype), veclen
            else:
                return blas_scal(1.0 / veclen, vec).astype(vec.dtype)
        else:
            if return_norm:
                return vec, 1
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: RaRe-Technologies/gensim
Commit Name: 8daace20a97c65f845ed008f4b60bdc62b12e250
Time: 2018-04-15
Author: 35378674+o-P-o@users.noreply.github.com
File Name: gensim/matutils.py
Class Name:
Method Name: unitvec


Project Name: RaRe-Technologies/gensim
Commit Name: 8daace20a97c65f845ed008f4b60bdc62b12e250
Time: 2018-04-15
Author: 35378674+o-P-o@users.noreply.github.com
File Name: gensim/matutils.py
Class Name:
Method Name: unitvec


Project Name: scikit-image/scikit-image
Commit Name: 9fcb6c9d9cadb8efa6426f29c94ab59928f41761
Time: 2020-04-22
Author: hbabcock@mac.com
File Name: skimage/morphology/extrema.py
Class Name:
Method Name: h_minima


Project Name: scikit-image/scikit-image
Commit Name: 9fcb6c9d9cadb8efa6426f29c94ab59928f41761
Time: 2020-04-22
Author: hbabcock@mac.com
File Name: skimage/morphology/extrema.py
Class Name:
Method Name: h_maxima