Exemple #1
0
    def setUp(self):
        import numpy

        self.n = 30
        self.P = poisson.poisson1d(self.n)
        for i in range(self.n):
            self.P[i, i] = 4.0
        self.A = poisson.poisson2d(self.n)
        self.S = poisson.poisson2d_sym(self.n)
        self.I = spmatrix.ll_mat_sym(self.n)
        for i in range(self.n):
            self.I[i, i] = -1.0
        self.mask = numpy.zeros(self.n ** 2, "l")
        self.mask[self.n / 2 * self.n : (self.n / 2 + 1) * self.n] = 1
        self.mask1 = numpy.zeros(self.n ** 2, "l")
        self.mask1[(self.n / 2 + 1) * self.n : (self.n / 2 + 2) * self.n] = 1
Exemple #2
0
    def setUp(self):
        import numpy

        self.n = 30
        self.P = poisson.poisson1d(self.n)
        for i in range(self.n):
            self.P[i, i] = 4.0
        self.A = poisson.poisson2d(self.n)
        self.S = poisson.poisson2d_sym(self.n)
        self.I = spmatrix.ll_mat_sym(self.n)
        for i in range(self.n):
            self.I[i, i] = -1.0
        self.mask = numpy.zeros(self.n**2, 'l')
        self.mask[self.n / 2 * self.n:(self.n / 2 + 1) * self.n] = 1
        self.mask1 = numpy.zeros(self.n**2, 'l')
        self.mask1[(self.n / 2 + 1) * self.n:(self.n / 2 + 2) * self.n] = 1
    def setUp(self):
        self.n = 200
        self.B = PysparseMatrix( matrix=poisson.poisson2d(self.n) )
        
        self.x_exact = numpy.ones(self.n*self.n)/self.n
        self.normx = 1.0/self.n
        self.b = self.B * self.x_exact

        h = 1.0/self.n
        lmbd_min = 4.0/h/h * (math.sin(math.pi*h/2.0) ** 2 +
                              math.sin(math.pi*h/2.0) ** 2)
        lmbd_max = 4.0/h/h * (math.sin((self.n - 1)*math.pi*h/2.0) ** 2 +
                              math.sin((self.n - 1)*math.pi*h/2.0) ** 2)
        cond = lmbd_max/lmbd_min
        self.tol = cond * macheps()
        self.relerr = 0.0
        self.nnz = self.B.getNnz()
        self.LU = None
        self.fmt = '\t%8.2e  %8.2e  %8d  %8d  %8d  %6.2f  %6.2f\n'
Exemple #4
0
    def setUp(self):
        self.n = 200
        self.B = PysparseMatrix(matrix=poisson.poisson2d(self.n))

        self.x_exact = numpy.ones(self.n * self.n) / self.n
        self.normx = 1.0 / self.n
        self.b = self.B * self.x_exact

        h = 1.0 / self.n
        lmbd_min = 4.0 / h / h * (math.sin(math.pi * h / 2.0)**2 +
                                  math.sin(math.pi * h / 2.0)**2)
        lmbd_max = 4.0 / h / h * (math.sin(
            (self.n - 1) * math.pi * h / 2.0)**2 + math.sin(
                (self.n - 1) * math.pi * h / 2.0)**2)
        cond = lmbd_max / lmbd_min
        self.tol = cond * macheps()
        self.relerr = 0.0
        self.nnz = self.B.getNnz()
        self.LU = None
        self.fmt = '\t%8.2e  %8.2e  %8d  %8d  %8d  %6.2f  %6.2f\n'
Exemple #5
0
 def setUp(self):
     self.n = 20
     self.A = poisson.poisson2d(self.n)
     self.S = poisson.poisson2d_sym(self.n)
     self.B = poisson.poisson2d_sym_blk(self.n)
Exemple #6
0
 def testNormGeneral(self):
     A = poisson.poisson2d(self.n)
     self.failUnless(A.norm("1") == 8)
     self.failUnless(A.norm("inf") == 8)
     self.failUnless(poisson.poisson1d(3).norm("fro") == 4)
Exemple #7
0
 def setUp(self):
     self.n = 20
     self.A = poisson.poisson2d(self.n)
     self.S = poisson.poisson2d_sym(self.n)
     self.B = poisson.poisson2d_sym_blk(self.n)
Exemple #8
0
 def testNormGeneral(self):
     A = poisson.poisson2d(self.n)
     self.failUnless(A.norm('1') == 8)
     self.failUnless(A.norm('inf') == 8)
     self.failUnless(poisson.poisson1d(3).norm('fro') == 4)