def testEye(self): X = sppy.eye(10) for i in range(10): self.assertEquals(X[i, i], 1) self.assertEquals(X.dtype, numpy.float) X = sppy.eye(10, numpy.int) for i in range(10): self.assertEquals(X[i, i], 1) self.assertEquals(X.dtype, numpy.int)
def testEye(self): n = 5 A = sppy.eye(n) for i in range(n): self.assertEquals(A[i,i], 1) self.assertEquals(A.nnz, n)