def test_argmax_from_countarrs(): # basic case vals = np.arange(10, dtype=np.float) vertinds = np.arange(10, dtype=np.uint32) adj_counts = np.ones((10, ), dtype=np.uint32) adj_inds_raw = np.arange(10, dtype=np.uint32)[::-1] # when contigous - OK adj_inds = adj_inds_raw.copy() argmax_from_countarrs(vals, vertinds, adj_counts, adj_inds) # yield assert_array_equal(inds, [5, 6, 7, 8, 9]) # test for errors - first - not contiguous # # The tests below cause odd errors and segfaults with numpy SVN # vintage June 2010 (sometime after 1.4.0 release) - see # http://groups.google.com/group/cython-users/browse_thread/thread/624c696293b7fe44?pli=1 """
def test_argmax_from_countarrs(): # basic case vals = np.arange(10, dtype=np.float) vertinds = np.arange(10, dtype=np.uint32) adj_counts = np.ones((10,), dtype=np.uint32) adj_inds_raw = np.arange(10, dtype=np.uint32)[::-1] # when contigous - OK adj_inds = adj_inds_raw.copy() argmax_from_countarrs(vals, vertinds, adj_counts, adj_inds) # yield assert_array_equal(inds, [5, 6, 7, 8, 9]) # test for errors - first - not contiguous # # The tests below cause odd errors and segfaults with numpy SVN # vintage June 2010 (sometime after 1.4.0 release) - see # http://groups.google.com/group/cython-users/browse_thread/thread/624c696293b7fe44?pli=1 """