Пример #1
0
def test_state_align_norm1():
    state = ortho_matrix(10)
    state1 = State(state)
    idx = np.arange(len(state))
    np.random.shuffle(idx)
    state2 = state1.sub(idx)

    # This should swap all back
    align2 = state1.align_norm(state2)
    assert np.allclose(state1.state, align2.state)
Пример #2
0
def test_state_align_norm2():
    state = ortho_matrix(15)
    state1 = State(state)
    idx = np.arange(len(state))
    np.random.shuffle(idx)
    state2 = state1.sub(idx)

    # This should swap all back
    align2, idx2 = state1.align_norm(state2, ret_index=True)
    assert np.allclose(state1.state, align2.state)
    assert np.allclose(state1.state, state2.sub(idx2).state)