diff --git a/GPy/kern/parts/sympykern.py b/GPy/kern/parts/sympykern.py index 7b98e47b..d109fea7 100644 --- a/GPy/kern/parts/sympykern.py +++ b/GPy/kern/parts/sympykern.py @@ -11,6 +11,7 @@ import tempfile import pdb import ast from kernpart import Kernpart +from ...util.config import config class spkern(Kernpart): """ @@ -110,8 +111,9 @@ class spkern(Kernpart): 'headers':['"sympy_helpers.h"'], 'sources':[os.path.join(current_dir,"parts/sympy_helpers.cpp")], 'extra_compile_args':extra_compile_args, - 'extra_link_args':['-lgomp'], + 'extra_link_args':[], 'verbose':True} + if config.getboolean('parallel', 'openmp'): self.weave_kwargs.append('-lgomp') def __add__(self,other): return spkern(self._sp_k+other._sp_k) @@ -343,7 +345,7 @@ class spkern(Kernpart): # Code to use when only X is provided. self._dK_dtheta_code_X = self._dK_dtheta_code.replace('Z[', 'X[') - self._dK_dX_code_X = self._dK_dX_code.replace('Z[', 'X[').replace('+= partial[', '+= 2*partial[') + self._dK_dX_code_X = self._dK_dX_code.replace('Z[', 'X[').replace('+= partial[', '+= 2*partial[') self._dK_dtheta_code_X = self._dK_dtheta_code.replace('Z2(', 'X2(') self._dK_dX_code_X = self._dK_dX_code_X.replace('Z2(', 'X2(') diff --git a/GPy/testing/kernel_tests.py b/GPy/testing/kernel_tests.py index f75eb580..a2194b65 100644 --- a/GPy/testing/kernel_tests.py +++ b/GPy/testing/kernel_tests.py @@ -35,7 +35,7 @@ class KernelTests(unittest.TestCase): def test_eq_sympykernel(self): if SYMPY_AVAILABLE: - kern = GPy.kern.eq_sympy(5, 3, output_ind=4) + kern = GPy.kern.eq_sympy(5, 3) self.assertTrue(GPy.kern.kern_test(kern, verbose=verbose)) def test_rbf_invkernel(self): diff --git a/GPy/util/symbolic.py b/GPy/util/symbolic.py index 395f9e3e..4b660c7f 100644 --- a/GPy/util/symbolic.py +++ b/GPy/util/symbolic.py @@ -237,52 +237,3 @@ class erfcx(Function): def eval(cls, arg): return erfc(arg)*exp(arg*arg) -class sinc_grad(Function): - nargs = 1 - - def fdiff(self, argindex=1): - if argindex==1: - # Strictly speaking this should be computed separately, as it won't work when x=0. See http://calculus.subwiki.org/wiki/Sinc_function - return ((2-x*x)*sin(self.args[0]) - 2*x*cos(x))/(x*x*x) - else: - raise ArgumentIndexError(self, argindex) - - - @classmethod - def eval(cls, x): - if x.is_Number: - if x is S.NaN: - return S.NaN - elif x is S.Zero: - return S.Zero - else: - return (x*cos(x) - sin(x))/(x*x) - -class sinc(Function): - - nargs = 1 - - def fdiff(self, argindex=1): - if argindex==1: - return sinc_grad(self.args[0]) - else: - raise ArgumentIndexError(self, argindex) - - - @classmethod - def eval(cls, arg): - if arg.is_Number: - if arg is S.NaN: - return S.NaN - elif arg is S.Zero: - return S.One - else: - return sin(arg)/arg - - if arg.func is asin: - x = arg.args[0] - return x / arg - - def _eval_is_real(self): - return self.args[0].is_real -