e20d7b28bb811000edd0790fb72df9e68875a063,src/gensim/similarities/docsim.py,MatrixSimilarity,getSimilarities,#MatrixSimilarity#Any#,121

Before Change


        else:
            vec = matutils.sparse2full(doc, self.numFeatures)
        
        vec.shape = (vec.size, 1)
        if vec.shape != (self.corpus.shape[1], 1):
            raise ValueError("vector shape mismatch; expected %s, got %s" % 
                             ((self.corpus.shape[1], 1,), vec.shape))
        

After Change


        vec = numpy.asfortranarray(vec, order = "F", dtype = self.corpus.dtype).reshape(self.numFeatures, 1)
        
        // compute cosine similarity against every other document in the collection
        gemv, = scipy.linalg.get_blas_funcs(("gemv",), (self.u,))
        allSims = gemv(self.corpus, vec) // N x T * T x 1 = N x 1
        allSims = list(allSims.flat) // convert to plain python list
        assert len(allSims) == self.corpus.shape[0] // make sure no document got lost!
        return allSims
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: RaRe-Technologies/gensim
Commit Name: e20d7b28bb811000edd0790fb72df9e68875a063
Time: 2010-07-31
Author: piskvorky@92d0401f-a546-4972-9173-107b360ed7e5
File Name: src/gensim/similarities/docsim.py
Class Name: MatrixSimilarity
Method Name: getSimilarities


Project Name: RaRe-Technologies/gensim
Commit Name: af3357375250903ecb380051915e15ba721c42f4
Time: 2010-07-31
Author: radimrehurek@seznam.cz
File Name: src/gensim/similarities/docsim.py
Class Name: MatrixSimilarity
Method Name: getSimilarities


Project Name: scipy/scipy
Commit Name: fd20b082a713a620abacfb120166af5545055063
Time: 2011-06-11
Author: fabian.pedregosa@inria.fr
File Name: scipy/sparse/linalg/isolve/lgmres.py
Class Name:
Method Name: norm2