729 |
if beta1==0: return x*0. |
if beta1==0: return x*0. |
730 |
|
|
731 |
if beta1> 0: |
if beta1> 0: |
732 |
beta1 = math.sqrt(beta1) # Normalize y to get v1 later. |
beta1 = math.sqrt(beta1) |
733 |
|
|
734 |
#------------------------------------------------------------------ |
#------------------------------------------------------------------ |
735 |
# Initialize quantities. |
# Initialize quantities. |
757 |
#--------------------------------------------------------------------- |
#--------------------------------------------------------------------- |
758 |
# Main iteration loop. |
# Main iteration loop. |
759 |
# -------------------------------------------------------------------- |
# -------------------------------------------------------------------- |
760 |
while not stoppingcriterium(rnorm,Anorm*ynorm): # ||r|| / (||A|| ||x||) |
while not stoppingcriterium(rnorm,Anorm*ynorm): # checks ||r|| < (||A|| ||x||) * TOL |
761 |
|
|
762 |
if iter >= iter_max: raise MaxIterReached,"maximum number of %s steps reached."%iter_max |
if iter >= iter_max: raise MaxIterReached,"maximum number of %s steps reached."%iter_max |
763 |
iter = iter + 1 |
iter = iter + 1 |
1088 |
|
|
1089 |
if solver=='MINRES': |
if solver=='MINRES': |
1090 |
if self.verbose: print "enter MINRES method (iter_max=%s)"%max_iter |
if self.verbose: print "enter MINRES method (iter_max=%s)"%max_iter |
1091 |
p=GMRES(Bz,self.__Aprod_GMRES,self.__Msolve_GMRES,self.__inner_p,self.__stoppingcriterium_MINRES,iter_max=max_iter, x=p*1.) |
p=MINRES(Bz,self.__Aprod_GMRES,self.__Msolve_GMRES,self.__inner_p,self.__stoppingcriterium_MINRES,iter_max=max_iter, x=p*1.) |
1092 |
# solve Au=f-B^*p |
# solve Au=f-B^*p |
1093 |
# A(u-v)=f-B^*p-Av |
# A(u-v)=f-B^*p-Av |
1094 |
# u=v+(u-v) |
# u=v+(u-v) |