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

revision 1481 by artak, Wed Apr 9 00:45:47 2008 UTC revision 1482 by artak, Wed Apr 9 02:29:47 2008 UTC
# Line 708  def MINRES(b, Aprod, Msolve, bilinearfor Line 708  def MINRES(b, Aprod, Msolve, bilinearfor
708      #  solves the system My = x for any given vector x.      #  solves the system My = x for any given vector x.
709      #      #
710      #      #
711
#  Initialize

iter   = 0
Anorm = 0
ynorm = 0
x=x*0
712      #------------------------------------------------------------------      #------------------------------------------------------------------
713      # Set up y and v for the first Lanczos vector v1.      # Set up y and v for the first Lanczos vector v1.
714      # y  =  beta1 P' v1,  where  P = C**(-1).      # y  =  beta1 P' v1,  where  P = C**(-1).
715      # v is really P' v1.      # v is really P' v1.
716      #------------------------------------------------------------------      #------------------------------------------------------------------
717        if x==None:
718          x=0*b
719        else:
720          b += (-1)*Aprod(x)
721
722      r1    = b      r1    = b
723      y = Msolve(b)      y = Msolve(b)
724      beta1 = bilinearform(b,y)      beta1 = bilinearform(b,y)
# Line 735  def MINRES(b, Aprod, Msolve, bilinearfor Line 734  def MINRES(b, Aprod, Msolve, bilinearfor
734      #------------------------------------------------------------------      #------------------------------------------------------------------
735      # Initialize other quantities.      # Initialize other quantities.
736      # ------------------------------------------------------------------      # ------------------------------------------------------------------
737    #  Initialize
738
739        iter   = 0
740        Anorm = 0
741        ynorm = 0
742    #    x=x*0
743
744      oldb   = 0      oldb   = 0
745      beta   = beta1      beta   = beta1
746      dbar   = 0      dbar   = 0
# Line 840  def MINRES(b, Aprod, Msolve, bilinearfor Line 846  def MINRES(b, Aprod, Msolve, bilinearfor
846          rnorm  = phibar          rnorm  = phibar
847