Changeset 2680 for trunk

Show
Ignore:
Timestamp:
07/14/2008 03:16:24 PM (6 months ago)
Author:
wd15
Message:

added sensible tolerance normalization

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/fipy/solvers/pysparse/linearLUSolver.py

    r2331 r2680  
    8989        LU = superlu.factorize(L._getMatrix().to_csr()) 
    9090 
     91        error0 = numerix.sqrt(numerix.sum((L * x - b)**2)) 
     92 
    9193        for iteration in range(self.iterations): 
    9294            errorVector = L * x - b 
    93             tol = max(numerix.absolute(errorVector*maxdiag)) 
    94             # Multiplied by maxdiag so that it is equal to the residual seen externally 
    9595 
    96             if tol <= self.tolerance: 
     96            if (numerix.sqrt(numerix.sum(errorVector**2)) / error0) <= self.tolerance: 
    9797                break 
    9898 
     
    100100            LU.solve(errorVector, xError) 
    101101            x[:] = x - xError 
    102  
    103             #tol = max(numerix.absolute(xError)) 
    104             # Old termination condition was based on the correction made to x