def testOnes(self): X = sppy.ones((5, 5)) self.assertEquals(X.shape, (5, 5)) nptst.assert_array_equal(X.toarray(), numpy.ones((5,5))) x = sppy.ones((5, )) self.assertEquals(x.shape, (5, )) nptst.assert_array_equal(x.toarray(), numpy.ones((5,)))
def testOnes(self): X = sppy.ones((5, 5)) self.assertEquals(X.shape, (5, 5)) nptst.assert_array_equal(X.toarray(), numpy.ones((5, 5))) x = sppy.ones((5, )) self.assertEquals(x.shape, (5, )) nptst.assert_array_equal(x.toarray(), numpy.ones((5, )))
def complement(self): """ Returns a graph with identical vertices (same reference) to the current one, but with the complement of the set of edges. Edges that do not exist have weight 1. """ newGraph = CsArrayGraph(self.vList, self.undirected) newGraph.W = sppy.ones((newGraph.W.shape)) newGraph.W[self.W.nonzero()] = 0 newGraph.W.prune() newGraph.W.compress() return newGraph