summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python
diff options
context:
space:
mode:
authorepapoutsellis <epapoutsellis@gmail.com>2019-04-29 16:31:36 +0100
committerepapoutsellis <epapoutsellis@gmail.com>2019-04-29 16:31:36 +0100
commit892002e03206a422a4ea89863939ee806be20c24 (patch)
tree41925bbce8e75d2f9ddf09c8dbfcd2be5a7f7473 /Wrappers/Python
parentf49f9835c03aae6a3abc4c35962f12e5d10b0ad2 (diff)
downloadframework-892002e03206a422a4ea89863939ee806be20c24.tar.gz
framework-892002e03206a422a4ea89863939ee806be20c24.tar.bz2
framework-892002e03206a422a4ea89863939ee806be20c24.tar.xz
framework-892002e03206a422a4ea89863939ee806be20c24.zip
fix KL out
Diffstat (limited to 'Wrappers/Python')
-rw-r--r--Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py b/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py
index dc0411e..51a008f 100644
--- a/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py
+++ b/Wrappers/Python/ccpi/optimisation/functions/KullbackLeibler.py
@@ -63,7 +63,6 @@ class KullbackLeibler(Function):
return 1 - self.b/(x + self.bnoise)
else:
x.add(self.bnoise, out=out)
-
self.b.divide(out, out=out)
out.subtract(1, out=out)
out *= -1
@@ -106,16 +105,18 @@ class KullbackLeibler(Function):
z = x + tau * self.bnoise
return 0.5*((z + 1) - ((z-1)**2 + 4 * tau * self.b).sqrt())
else:
- 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()) )
+ #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