def test_normalize(): source = np.matrix(test_matrices[0][0]) target = np.matrix(test_matrices[0][1]) norm = mc.normalize(source) assert np.array_equal(norm, target)
def test_normalize_sparse(): source = csc_matrix(test_matrices[0][0]) target = np.matrix(test_matrices[0][1]) norm = mc.normalize(source).todense() assert np.array_equal(norm, target)
def test_iterate_sparse(): source = csc_matrix(test_matrices[6][0]) target = np.matrix(test_matrices[6][1]) iterated = mc.normalize(mc.iterate(source, 2, 2)).todense() assert np.array_equal(np.round(iterated, 4), np.round(target, 4))