예제 #1
0
def test_hamming_matrix():
    answer = np.array([[0, 1, 1, 2, 1, 2, 2, 3], [1, 0, 2, 1, 2, 1, 3, 2],
                       [1, 2, 0, 1, 2, 3, 1, 2], [2, 1, 1, 0, 3, 2, 2, 1],
                       [1, 2, 2, 3, 0, 1, 1, 2], [2, 1, 3, 2, 1, 0, 2, 1],
                       [2, 3, 1, 2, 1, 2, 0, 1], [3, 2, 2, 1, 2, 1, 1,
                                                  0]]).astype(float)
    assert np.array_equal(distance._hamming_matrix(3), answer)
예제 #2
0
def test_hamming_matrix():
    answer = np.array([[0, 1, 1, 2, 1, 2, 2, 3],
                       [1, 0, 2, 1, 2, 1, 3, 2],
                       [1, 2, 0, 1, 2, 3, 1, 2],
                       [2, 1, 1, 0, 3, 2, 2, 1],
                       [1, 2, 2, 3, 0, 1, 1, 2],
                       [2, 1, 3, 2, 1, 0, 2, 1],
                       [2, 3, 1, 2, 1, 2, 0, 1],
                       [3, 2, 2, 1, 2, 1, 1, 0]]).astype(float)
    assert np.array_equal(distance._hamming_matrix(3), answer)
예제 #3
0
def test_large_hamming_matrix():
    n = distance._NUM_PRECOMPUTED_HAMMING_MATRICES + 1
    distance._hamming_matrix(n)
예제 #4
0
def test_large_hamming_matrix():
    n = distance._NUM_PRECOMPUTED_HAMMING_MATRICES + 1
    distance._hamming_matrix(n)