コード例 #1
0
    def profilePySparseAssign(self):
        W = spmatrix.ll_mat(self.n,self.n)
        V = numpy.random.randint(0, self.n, (self.m,2))
        u = numpy.random.rand(self.m)

        def runAdd():
            for i in range(self.m):
                W[int(V[i,0]), int(V[i,1])] = u[i]

        ProfileUtils.profile('runAdd()', globals(), locals())
コード例 #2
0
    def profilePySparseKeys(self):
        """
        Test for memory leak 
        """
        W = spmatrix.ll_mat(self.n,self.n)
        V = numpy.random.randint(0, self.n, (self.m,2))
        u = numpy.random.rand(self.m)

        for i in range(self.m):
            W[int(V[i,0]), int(V[i,1])] = u[i]

        def runKeys():
            for i in range(self.m):
                for j in range(self.n):
                    neighbours = W[j, :]
                    #neighbours = W[j, :].keys()

        print("Running keys")
        runKeys()