Esempio n. 1
0
 def test_read_write_sparse_csc_matrix_compressed(self):
     expected = sp.csc_matrix(
         (np.array([1, 2, 3, 4, 5, 6]),
          (np.array([0, 0, 1, 2, 2, 2]), np.array([0, 2, 2, 0, 1, 2]))),
         shape=(3, 3))
     filename = os.path.join(self.tempdir, 'test_read_write_sparse_csc_matrix_compressed.npz')
     fileio.write_sparse_matrix(expected, filename, compressed=True)
     observed = fileio.read_sparse_csc_matrix(filename)
     self.assertEqual(abs(observed - expected).nnz, 0)
Esempio n. 2
0
 def test_read_write_sparse_csc_matrix_compressed(self):
     expected = sp.csc_matrix(
         (np.array([1, 2, 3, 4, 5, 6]),
          (np.array([0, 0, 1, 2, 2, 2]), np.array([0, 2, 2, 0, 1, 2]))),
         shape=(3, 3))
     filename = os.path.join(self.tempdir, 'test_read_write_sparse_csc_matrix_compressed.npz')
     fileio.write_sparse_matrix(expected, filename, compressed=True)
     observed = fileio.read_sparse_csc_matrix(filename)
     self.assertEqual(abs(observed - expected).nnz, 0)