Refactor checking for cython availability

This commit is contained in:
Jayanth Koushik 2017-11-16 20:29:49 -05:00
parent 6605b736d8
commit 928559216c
3 changed files with 11 additions and 11 deletions

View file

@ -7,10 +7,10 @@ from .config import config
try:
from . import choleskies_cython
cython_choleskies_working = True
use_choleskies_cython = config.getboolean('cython', 'working')
except ImportError:
print('warning in choleskies: failed to import cython module: falling back to numpy')
cython_choleskies_working = False
use_choleskies_cython = False
def safe_root(N):
@ -103,7 +103,7 @@ def indexes_to_fix_for_low_rank(rank, size):
return np.setdiff1d(np.arange((size**2+size)/2), keep)
if cython_choleskies_working and config.getboolean('cython', 'working'):
if use_choleskies_cython:
triang_to_flat = _triang_to_flat_cython
flat_to_triang = _flat_to_triang_cython
backprop_gradient = choleskies_cython.backprop_gradient_par_c