Skip to content

Commit

Permalink
DiscreteDP: 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 25c7d7c commit b18ab8f
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions quantecon/markov/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
import warnings
import numpy as np
import scipy.sparse as sp
from numba import jit

from .core import MarkovChain
from ..util import numba_installed, jit


class DiscreteDP(object):
Expand Down Expand Up @@ -897,6 +897,7 @@ def __dir__(self):
return self.keys()


@jit(nopython=True)
def _s_wise_max_argmax(a_indices, a_indptr, vals, out_max, out_argmax):
n = len(out_max)
for i in range(n):
Expand All @@ -908,10 +909,8 @@ def _s_wise_max_argmax(a_indices, a_indptr, vals, out_max, out_argmax):
out_max[i] = vals[m]
out_argmax[i] = a_indices[m]

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


@jit(nopython=True)
def _s_wise_max(a_indices, a_indptr, vals, out_max):
n = len(out_max)
for i in range(n):
Expand All @@ -922,20 +921,15 @@ def _s_wise_max(a_indices, a_indptr, vals, out_max):
m = j
out_max[i] = vals[m]

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


@jit(nopython=True)
def _find_indices(a_indices, a_indptr, sigma, out):
n = len(sigma)
for i in range(n):
for j in range(a_indptr[i], a_indptr[i+1]):
if sigma[i] == a_indices[j]:
out[i] = j

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


@jit(nopython=True)
def _has_sorted_sa_indices(s_indices, a_indices):
Expand Down

0 comments on commit b18ab8f

Please sign in to comment.