Commit dbe068db authored by Reimar H Leike's avatar Reimar H Leike
Browse files

more fixes

parent 574cc254
...@@ -50,4 +50,4 @@ def InverseGammaOperator(domain, alpha, q, delta=0.001): ...@@ -50,4 +50,4 @@ def InverseGammaOperator(domain, alpha, q, delta=0.001):
distance between sampling points for linear interpolation. distance between sampling points for linear interpolation.
""" """
func = lambda x: np.log(invgamma.ppf(norm.cdf(x), alpha)) func = lambda x: np.log(invgamma.ppf(norm.cdf(x), alpha))
return InterpolatingOperator(domain, func, (-8.2,8.2), delta) return InterpolatingOperator(domain, func, (-8.2,8.2), delta).exp()
...@@ -67,14 +67,14 @@ class InterpolatingOperator(Operator): ...@@ -67,14 +67,14 @@ class InterpolatingOperator(Operator):
# Operator # Operator
fi = np.floor(val).astype(int) fi = np.floor(val).astype(int)
w = val - fi w = val - fi
res = np.exp((1 - w)*self._table[fi] + w*self._table[fi + 1]) res = (1 - w)*self._table[fi] + w*self._table[fi + 1]
points = Field.from_local_data(self._domain, res) points = Field.from_local_data(self._domain, res)
if not lin: if not lin:
return points return points
# Derivative of linear interpolation # Derivative of linear interpolation
der = self._deriv[fi]*res der = self._deriv[fi]
jac = makeOp(Field.from_local_data(self._domain, der)) jac = makeOp(Field.from_local_data(self._domain, der))
jac = jac(x.jac) jac = jac(x.jac)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment