Skip to content

Commit

Permalink
MarkovChain: Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamad committed Mar 19, 2016
1 parent 457578b commit 8850b31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion quantecon/markov/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def __init__(self, P, state_values=None):
raise ValueError('The rows of P must sum to 1')

# Call the setter method
self._state_values = state_values
self.state_values = state_values

# To analyze the structure of P as a directed graph
self._digraph = None
Expand Down
7 changes: 4 additions & 3 deletions quantecon/markov/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,18 +383,19 @@ def test_mc_sample_path_lln():

class TestMCStateValues:
def setUp(self):
self.state_values = np.array([[0, 1], [2, 3], [4, 5]])
state_values = [[0, 1], [2, 3], [4, 5]] # Pass python list
self.state_values = np.array(state_values)

self.mc_reducible_dict = {
'mc': MarkovChain([[1, 0, 0], [1, 0, 0], [0, 0, 1]],
state_values=self.state_values),
state_values=state_values),
'coms': [[0], [1], [2]],
'recs': [[0], [2]]
}

self.mc_periodic_dict = {
'mc': MarkovChain([[0, 1, 0], [0, 0, 1], [1, 0, 0]],
state_values=self.state_values),
state_values=state_values),
'coms': [[0, 1, 2]],
'recs': [[0, 1, 2]],
'cycs': [[0], [1], [2]]
Expand Down

0 comments on commit 8850b31

Please sign in to comment.