else: print(' ', end = '') print('{:e} / {:e}'.format(storage[1 + 2 * nu], storage[2 * nu]), end = '') if mu > 1: print(' (rhs #{:d})'.format(nu + 1), end = '') print('') if it > 45: status = 1 else: for nu in xrange(mu): if storage[1 + 2 * nu] / storage[2 * nu] > 1.0e-2: status = 1 hpddm.schwarzDestroy(ctypes.byref(A)) else: S = ctypes.POINTER(hpddm.Subdomain)() hpddm.subdomainNumfact(ctypes.byref(S), Mat) hpddm.subdomainSolve(S, f, sol) nrmb = numpy.linalg.norm(f, axis = 0) tmp = numpy.empty_like(f) hpddm.csrmv(Mat, sol, tmp) tmp -= f nrmAx = numpy.linalg.norm(tmp, axis = 0) if mu == 0: nrmb = [ nrmb ] nrmAx = [ nrmAx ] mu = 1 for nu in xrange(mu): if nu == 0: print(' --- error = ', end = '') else: print(' ', end = '')
else: print(' ', end = '') print('{:e} / {:e}'.format(storage[1 + 2 * nu], storage[2 * nu]), end = '') if mu > 1: print(' (rhs #{:d})'.format(nu + 1), end = '') print('') if it > (60 if int(hpddm.optionVal(opt, b'krylov_method')) == 6 else 45): status = 1 else: for nu in xrange(mu): if storage[1 + 2 * nu] / storage[2 * nu] > 1.0e-2: status = 1 hpddm.schwarzDestroy(ctypes.byref(A)) else: S = ctypes.POINTER(hpddm.Subdomain)() hpddm.subdomainNumfact(ctypes.byref(S), Mat) hpddm.subdomainSolve(S, f, sol) nrmb = numpy.linalg.norm(f, axis = 0) tmp = numpy.empty_like(f) hpddm.csrmv(Mat, sol, tmp) tmp -= f nrmAx = numpy.linalg.norm(tmp, axis = 0) if mu == 0: nrmb = [ nrmb ] nrmAx = [ nrmAx ] mu = 1 for nu in xrange(mu): if nu == 0: print(' --- residual = ', end = '') else: print(' ', end = '')