def __call__(self, x): self.n += 1 if self.n == 1 or self.n % 10 == 0: resnorm = norm(self.pde.matvec(x, 1)) gradient = kuramoto.c_gradAdj() print 'iter ', self.n, resnorm, gradient self.hist.append([self.n, resnorm, gradient]) sys.stdout.flush()
def __call__(self, x): self.n += 1 if self.n == 1 or self.n % 10 == 0: resnorm = par_norm(self.pde.matvec(x, 1)) gradient = mpi_comm.allreduce(kuramoto.c_gradAdj()) if mpi_rank == 0: print 'iter ', self.n, resnorm, gradient self.hist.append([self.n, resnorm, gradient]) sys.stdout.flush()