예제 #1
0
def test_vector_roundtrip():
    "BR Tools : vector roundtrip transform"
    dimension = 10
    for _ in range(50):
        H = qutip.rand_herm(dimension, 0.5).full('F')
        vector = qutip.mat2vec(qutip.rand_dm(dimension, 0.5).full()).ravel()
        assert np.allclose(vector, _test_vector_roundtrip(H, vector))
예제 #2
0
def test_vector_roundtrip():
    "BR Tools : vector roundtrip transform"
    N = 10
    for kk in range(50):
        H = rand_herm(N,0.5)
        h = H.full('F')
        R = rand_dm(N,0.5)
        r = mat2vec(R.full()).ravel()
        out = _test_vector_roundtrip(h,r)
        assert_(np.allclose(r,out))