Skip to content

Commit

Permalink
MarkovChain: Remove util.numba_installed
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamad committed Mar 19, 2016
1 parent 84fdbaa commit 457578b
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions quantecon/markov/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@
"""
from __future__ import division
import numbers
from fractions import gcd
import numpy as np
from scipy import sparse
from fractions import gcd
from numba import jit

from .gth_solve import gth_solve
from ..graph_tools import DiGraph

# -Check if Numba is Available- #
from ..util import searchsorted, check_random_state, numba_installed, jit
from ..util import searchsorted, check_random_state


class MarkovChain(object):
Expand Down Expand Up @@ -455,6 +455,7 @@ def simulate(self, ts_length, init=None, num_reps=None, return_values=True,
return X


@jit(nopython=True)
def _generate_sample_paths(P_cdfs, init_states, random_values, out):
"""
Generate num_reps sample paths of length ts_length, where num_reps =
Expand All @@ -478,7 +479,7 @@ def _generate_sample_paths(P_cdfs, init_states, random_values, out):
Notes
-----
This routine is jit-complied if the module Numba is vailable.
This routine is jit-complied by Numba.
"""
num_reps, ts_length = out.shape
Expand All @@ -488,10 +489,8 @@ def _generate_sample_paths(P_cdfs, init_states, random_values, out):
for t in range(ts_length-1):
out[i, t+1] = searchsorted(P_cdfs[out[i, t]], random_values[i, t])

if numba_installed:
_generate_sample_paths = jit(nopython=True)(_generate_sample_paths)


@jit(nopython=True)
def _generate_sample_paths_sparse(P_cdfs1d, indices, indptr, init_states,
random_values, out):
"""
Expand Down Expand Up @@ -524,7 +523,7 @@ def _generate_sample_paths_sparse(P_cdfs1d, indices, indptr, init_states,
Notes
-----
This routine is jit-complied if the module Numba is vailable.
This routine is jit-complied by Numba.
"""
num_reps, ts_length = out.shape
Expand All @@ -536,10 +535,6 @@ def _generate_sample_paths_sparse(P_cdfs1d, indices, indptr, init_states,
random_values[i, t])
out[i, t+1] = indices[indptr[out[i, t]]+k]

if numba_installed:
_generate_sample_paths_sparse = \
jit(nopython=True)(_generate_sample_paths_sparse)


_get_method_docstr = \
"""
Expand Down

0 comments on commit 457578b

Please sign in to comment.