Пример #1
0
 def testVecMatIndexConversion(self):
     """
     Superoperator: Conversion between matrix and vector indices
     """
     N = 10
     for I in range(N * N):
         i, j = vec2mat_index(N, I)
         I2 = mat2vec_index(N, i, j)
         assert_(I == I2)
Пример #2
0
 def testVecMatIndexConversion(self):
     """
     Superoperator: Conversion between matrix and vector indices
     """
     N = 10
     for I in range(N * N):
         i, j = vec2mat_index(N, I)
         I2 = mat2vec_index(N, i, j)
         assert_(I == I2)
Пример #3
0
 def testVecMatIndexCompability(self):
     """
     Superoperator: Compatibility between matrix/vector and
     corresponding index conversions.
     """
     N = 10
     M = scipy.rand(N, N)
     V = mat2vec(M)
     for I in range(N * N):
         i, j = vec2mat_index(N, I)
         assert_(V[I][0] == M[i, j])
Пример #4
0
 def testVecMatIndexCompability(self):
     """
     Superoperator: Compatibility between matrix/vector and
     corresponding index conversions.
     """
     N = 10
     M = scipy.rand(N, N)
     V = mat2vec(M)
     for I in range(N * N):
         i, j = vec2mat_index(N, I)
         assert_(V[I][0] == M[i, j])