p = [[0.4, 0.6], [1., 0.]] is regular because the square of that matrix is [[0.76, 0.24], [0.4 , 0.6]], which has all positive entries.
Current Behavior
The is_regular property returns False.
Steps to Reproduce
p = [[0.4, 0.6], [1., 0.]]
mc = MarkovChain(p, ['A', 'B'])
print(mc.is_regular)
Possible Solution
The problem seems to arise from the inappropriate use of in the source code for is_regular, specifically in the second-to-last line of the definition: `result = _np.all(self.__pk > 0.0). The ** gives element-wise exponentiation. For matrix exponentiation, use_np.linalg.matrix_power(): result = _np.all(_np.linalg.matrix_power(self.__p, k) > 0.0)`
Expected Behavior
p = [[0.4, 0.6], [1., 0.]]
is regular because the square of that matrix is[[0.76, 0.24], [0.4 , 0.6]]
, which has all positive entries.Current Behavior
The
is_regular
property returnsFalse
.Steps to Reproduce
Possible Solution
The problem seems to arise from the inappropriate use of in the source code for
is_regular
, specifically in the second-to-last line of the definition: `result = _np.all(self.__pk > 0.0). The ** gives element-wise exponentiation. For matrix exponentiation, use
_np.linalg.matrix_power():
result = _np.all(_np.linalg.matrix_power(self.__p, k) > 0.0)`