markovmodel / msmtools

Tools for estimating and analyzing Markov state models
GNU Lesser General Public License v3.0
40 stars 26 forks source link

Reversible decompositions should return real numbes #69

Closed franknoe closed 4 years ago

franknoe commented 8 years ago

Reversible decompositions should return purely reals, i.e. use *.real on the result before returning it. This affects all eigenvalue and eigenvector decompositions. Example:

P = np.array([[0.9, 0.1, 0.0],
              [0.1, 0.8, 0.1],
              [0.0, 0.2, 0.8]])
msmana.rdl_decomposition(P, norm='reversible')

currently returns:

(array([[ 1.        , -1.14412281, -0.43701602],
        [ 1.        ,  0.43701602,  1.14412281],
        [ 1.        ,  1.41421356, -1.41421356]]),
 array([[ 1.0000000+0.j,  0.0000000+0.j,  0.0000000+0.j],
        [ 0.0000000+0.j,  0.8618034+0.j,  0.0000000+0.j],
        [ 0.0000000+0.j,  0.0000000+0.j,  0.6381966+0.j]]),
 array([[ 0.4       ,  0.4       ,  0.2       ],
        [-0.45764912,  0.17480641,  0.28284271],
        [-0.17480641,  0.45764912, -0.28284271]]))

The diagonal array has complex format, but should be real.