474 |
|
|
475 |
""" |
""" |
476 |
self.history.append(norm_r) |
self.history.append(norm_r) |
477 |
if self.verbose: print "iter: #s: inner(rhat,r) = #e"#(len(self.history)-1, self.history[-1]) |
if self.verbose: print "iter: %s: inner(rhat,r) = %e"#(len(self.history)-1, self.history[-1]) |
478 |
return self.history[-1]<=self.tolerance * self.history[0] |
return self.history[-1]<=self.tolerance * self.history[0] |
479 |
|
|
480 |
def stoppingcriterium2(self,norm_r,norm_b,solver="GMRES",TOL=None): |
def stoppingcriterium2(self,norm_r,norm_b,solver="GMRES",TOL=None): |
493 |
if TOL==None: |
if TOL==None: |
494 |
TOL=self.tolerance |
TOL=self.tolerance |
495 |
self.history.append(norm_r) |
self.history.append(norm_r) |
496 |
if self.verbose: print "iter: #s: norm(r) = #e"#(len(self.history)-1, self.history[-1]) |
if self.verbose: print "iter: %s: norm(r) = %e"#(len(self.history)-1, self.history[-1]) |
497 |
return self.history[-1]<=TOL * norm_b |
return self.history[-1]<=TOL * norm_b |
498 |
|
|
499 |
def PCG(b, Aprod, Msolve, bilinearform, stoppingcriterium, x=None, iter_max=100): |
def PCG(b, Aprod, Msolve, bilinearform, stoppingcriterium, x=None, iter_max=100): |
1604 |
@param text: a text message |
@param text: a text message |
1605 |
@type text: C{str} |
@type text: C{str} |
1606 |
""" |
""" |
1607 |
if self.__verbose: print "#s: #s"%(str(self),text) |
if self.__verbose: print "%s: %s"%(str(self),text) |
1608 |
|
|
1609 |
def solve_f(self,u,p,tol=1.e-8): |
def solve_f(self,u,p,tol=1.e-8): |
1610 |
""" |
""" |