Example #1
0
    def _solve_(self, L, x, b):

        A = L._getMatrix().to_csr()
        
        Assor=precon.jacobi(L._getMatrix())
        
        info, iter, relres = itsolvers.gmres(A, b, x, self.tolerance, self.iterations, Assor)
        
        self._raiseWarning(info, iter, relres)
Example #2
0
c = Numeric.ones(n*n, 'd')
for loop in xrange(n*n):
    b[loop]= loop
    c[loop] = loop
y = Numeric.ones(n*n, 'd')
S.matvec(b,y)
b = y
#print b


# ---------------------------------------------------------------------------------------

t1 = time.clock()

x = Numeric.zeros(n*n, 'd')
info, iter, relres = itsolvers.gmres(S, b, x, 1e-12, 200, None, 100)
print 'info=%d, iter=%d, relres=%e' % (info, iter, relres)

print 'Time for solving the system using SSS matrix: %8.2f sec' % (time.clock() - t1, )

print 'norm(x) = %g' % math.sqrt(Numeric.dot(x, x))

r = Numeric.zeros(n*n, 'd')
S.matvec(x, r)
r = b - r
print 'norm(b - A*x) = %g' % math.sqrt(Numeric.dot(r, r))

# ---------------------------------------------------------------------------------------

t1 = time.clock()
Example #3
0
e = Numeric.ones(n * n, 'd')
c = Numeric.ones(n * n, 'd')
for loop in xrange(n * n):
    b[loop] = loop
    c[loop] = loop
y = Numeric.ones(n * n, 'd')
S.matvec(b, y)
b = y
#print b

# ---------------------------------------------------------------------------------------

t1 = time.clock()

x = Numeric.zeros(n * n, 'd')
info, iter, relres = itsolvers.gmres(S, b, x, 1e-12, 200, None, 100)
print 'info=%d, iter=%d, relres=%e' % (info, iter, relres)

print 'Time for solving the system using SSS matrix: %8.2f sec' % (
    time.clock() - t1, )

print 'norm(x) = %g' % math.sqrt(Numeric.dot(x, x))

r = Numeric.zeros(n * n, 'd')
S.matvec(x, r)
r = b - r
print 'norm(b - A*x) = %g' % math.sqrt(Numeric.dot(r, r))

# ---------------------------------------------------------------------------------------

t1 = time.clock()