示例#1
0
 def test_filter_by_shape(self):
     rmin = 50
     rmax = 1000
     cmin = 200
     cmax = 5000
     matrices = p.search(rowbounds = (rmin, rmax), colbounds=(cmin, cmax))
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertTrue(matrix.rows >= rmin and matrix.rows <= rmax and matrix.cols >= cmin and matrix.cols <= cmax)
示例#2
0
 def test_filter_by_shape(self):
     rmin = 50
     rmax = 1000
     cmin = 200
     cmax = 5000
     matrices = p.search(rowbounds=(rmin, rmax), colbounds=(cmin, cmax))
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertTrue(matrix.rows >= rmin and matrix.rows <= rmax
                         and matrix.cols >= cmin and matrix.cols <= cmax)
示例#3
0
def get_all_by_shape(rmin=50, rmax=1000, cmin=200, cmax=5000):
    matrices = uf.search(rowbounds=(rmin, rmax), colbounds=(cmin, cmax))

    print "Found {} matrices within the range ({}-{}) rows and ({}-{}) cols".format(
        len(matrices), rmin, rmax, cmin, cmax)
    for matrix in matrices:
        matrix.download(destpath='./matrices', extract=True)

        directory = './matrices/{}'.format(matrix.name)
        filename = '{}.mtx'.format(matrix.name)
        shutil.move(directory + '/' + filename, directory + '.mtx')
        shutil.rmtree(directory)
示例#4
0
 def test_search_by_id(self):
     m = p.search(42)
     self.assertEqual(len(m), 1)
     self.assertEqual(m[0].id, 42)
示例#5
0
 def test_filter_by_spd_false(self):
     matrices = p.search(isspd=False)
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertFalse(matrix.isspd)
示例#6
0
 def test_filter_by_rows(self):
     matrices = p.search(rowbounds=(None, 1000))
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertTrue(matrix.rows <= 1000)
示例#7
0
 def test_search_by_name(self):
     matrices = p.search("c-")
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertTrue(matrix.name.startswith("c-"))
示例#8
0
 def test_search_by_group(self):
     matrices = p.search("HB/*")
     for matrix in matrices:
         self.assertEqual(matrix.group, "HB")
示例#9
0
 def test_search_by_group(self):
     matrices = p.search("HB/*")
     for matrix in matrices:
         self.assertEqual(matrix.group, "HB")
示例#10
0
 def test_filter_by_spd_false(self):
     matrices = p.search(isspd = False)
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertFalse(matrix.isspd)
示例#11
0
 def test_search_by_id(self):
     m = p.search(42)
     self.assertEqual(len(m), 1)
     self.assertEqual(m[0].id, 42)
示例#12
0
 def test_filter_by_rows(self):
     matrices = p.search(rowbounds = (None, 1000))
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertTrue(matrix.rows <= 1000)
示例#13
0
 def test_search_by_name(self):
     matrices = p.search("c-")
     self.assertTrue(len(matrices) > 0)
     for matrix in matrices:
         self.assertTrue(matrix.name.startswith("c-"))