示例#1
0
 def test_deffmat_first2(self):
     D = util.sparse_diffmat(4, 1, 0.5, order=2)
     self.assertTrue(
         np.all(D.todense() == np.array(
             [[-3, 4, -1, 0], [-1, 0, 1, 0], [0, -1, 0, 1], [0, -1, 4, -3]],
             dtype=np.float64)))
     return
示例#2
0
 def test_deffmat_first2(self):
     D = util.sparse_diffmat(4, 1, 0.5, order=2)
     self.assertTrue(np.all(D.todense() ==
                     np.array([[-3, 4, -1, 0],
                               [-1, 0, 1, 0],
                               [0, -1, 0, 1],
                               [0, -1, 4, -3]], dtype=np.float64)))
     return
示例#3
0
    def test_diffmat_first(self):

        D = util.sparse_diffmat(4, 1, 1, order=2)
        self.assertTrue(
            np.all(D.todense() == np.array(
                [[-1.5, 2, -0.5, 0], [-0.5, 0, 0.5, 0], [0, -0.5, 0, 0.5],
                 [0, -0.5, 2, -1.5]])))
        return
示例#4
0
    def test_diffmat_first(self):

        D = util.sparse_diffmat(4, 1, 1, order=2)
        self.assertTrue(np.all(D.todense() ==
                        np.array([[-1.5, 2, -0.5, 0],
                                  [-0.5, 0, 0.5, 0],
                                  [0, -0.5, 0, 0.5],
                                  [0, -0.5, 2, -1.5]])))
        return