diff options
author | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-29 16:53:24 +0100 |
---|---|---|
committer | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-29 16:53:24 +0100 |
commit | d6dff2e80d5364450a6ca47a6f7aca66aa2ea289 (patch) | |
tree | c2c68b6578e26151786743225d585491cac842eb /Wrappers | |
parent | 58c3977744d09a4a8f72125902470098a10a75b4 (diff) | |
download | framework-d6dff2e80d5364450a6ca47a6f7aca66aa2ea289.tar.gz framework-d6dff2e80d5364450a6ca47a6f7aca66aa2ea289.tar.bz2 framework-d6dff2e80d5364450a6ca47a6f7aca66aa2ea289.tar.xz framework-d6dff2e80d5364450a6ca47a6f7aca66aa2ea289.zip |
fix KL funcs
Diffstat (limited to 'Wrappers')
-rw-r--r-- | Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py b/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py index 51a008f..c5661b0 100644 --- a/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py +++ b/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py @@ -105,18 +105,21 @@ class KullbackLeibler(Function): z = x + tau * self.bnoise return 0.5*((z + 1) - ((z-1)**2 + 4 * tau * self.b).sqrt()) else: - z = x + tau * self.bnoise - out.fill( 0.5*((z + 1) - ((z-1)**2 + 4 * tau * self.b).sqrt()) ) - #z_m = x + tau * self.bnoise -1 - #self.b.multiply(4*tau, out=out) - #z_m.multiply(z_m, out=z_m) - #out += z_m - #out.sqrt(out=out) - #z_m.sqrt(out=z_m) - #z_m += 2 - #out *= -1 - #out += z_m - #out *= 0.5 +# z = x + tau * self.bnoise +# out.fill( 0.5*((z + 1) - ((z-1)**2 + 4 * tau * self.b).sqrt()) ) + + + tmp1 = x + tau * self.bnoise - 1 + tmp2 = tmp1 + 2 + + self.b.multiply(4*tau, out=out) + tmp1.multiply(tmp1, out=tmp1) + out += tmp1 + out.sqrt(out=out) + + out *= -1 + out += tmp2 + out *= 0.5 |