/[escript]/trunk/escript/py_src/pdetools.py
ViewVC logotype

Diff of /trunk/escript/py_src/pdetools.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2283 by gross, Wed Feb 11 06:48:28 2009 UTC revision 2284 by gross, Fri Feb 20 02:10:59 2009 UTC
# Line 723  def __givapp(c,s,vin): Line 723  def __givapp(c,s,vin):
723      """      """
724      vrot=vin      vrot=vin
725      if isinstance(c,float):      if isinstance(c,float):
726          vrot=[c*vrot[0]-s*vrot[1],s*vrot[0]+c*vrot[1]]          vrot=numarray.array([c*vrot[0]-s*vrot[1],s*vrot[0]+c*vrot[1]])
727      else:      else:
728          for i in range(len(c)):          for i in range(len(c)):
729              w1=c[i]*vrot[i]-s[i]*vrot[i+1]              w1=c[i]*vrot[i]-s[i]*vrot[i+1]
730          w2=s[i]*vrot[i]+c[i]*vrot[i+1]          w2=s[i]*vrot[i]+c[i]*vrot[i+1]
731              vrot[i:i+2]=w1,w2              vrot[i]=w1
732                vrot[i+1]=w2
733      return vrot      return vrot
734    
735  def __FDGMRES(F0, defect, x0, atol, iter_max=100, iter_restart=20):  def __FDGMRES(F0, defect, x0, atol, iter_max=100, iter_restart=20):
# Line 788  def __FDGMRES(F0, defect, x0, atol, iter Line 789  def __FDGMRES(F0, defect, x0, atol, iter
789              s[iter]=-h[iter+1,iter]/mu              s[iter]=-h[iter+1,iter]/mu
790              h[iter,iter]=c[iter]*h[iter,iter]-s[iter]*h[iter+1,iter]              h[iter,iter]=c[iter]*h[iter,iter]-s[iter]*h[iter+1,iter]
791              h[iter+1,iter]=0.0              h[iter+1,iter]=0.0
792              g[iter:iter+2]=__givapp(c[iter],s[iter],g[iter:iter+2])              gg=__givapp(c[iter],s[iter],numarray.array([g[iter],g[iter+1]]))
793                g[iter]=gg[0]
794                g[iter+1]=gg[1]
795    
796          # Update the residual norm          # Update the residual norm
797          rho=abs(g[iter+1])          rho=abs(g[iter+1])
# Line 949  def _GMRESm(r, Aprod, x, bilinearform, a Line 952  def _GMRESm(r, Aprod, x, bilinearform, a
952          s[iter]=-h[iter+1,iter]/mu          s[iter]=-h[iter+1,iter]/mu
953          h[iter,iter]=c[iter]*h[iter,iter]-s[iter]*h[iter+1,iter]          h[iter,iter]=c[iter]*h[iter,iter]-s[iter]*h[iter+1,iter]
954          h[iter+1,iter]=0.0          h[iter+1,iter]=0.0
955          g[iter:iter+2]=__givapp(c[iter],s[iter],g[iter:iter+2])                  gg=__givapp(c[iter],s[iter],numarray.array([g[iter],g[iter+1]]))
956                    g[iter]=gg[0]
957                    g[iter+1]=gg[1]
958  # Update the residual norm  # Update the residual norm
959    
960          rho=abs(g[iter+1])          rho=abs(g[iter+1])

Legend:
Removed from v.2283  
changed lines
  Added in v.2284

  ViewVC Help
Powered by ViewVC 1.1.26