trying to update q and inout(q) simultanuously
ok imposing 0<=q(r)<=1
condition for stopping iteration = kl-divergence change is below 1/1000 of its new value