Example #1
0
 def test_diag(self):
     assert_equal(
         tri(4, k=1),
         array([[1, 1, 0, 0], [1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1]]))
     assert_equal(
         tri(4, k=-1),
         array([[0, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0]]))
Example #2
0
 def test_diag2d(self):
     assert_equal(tri(3,4,k=2),array([[1,1,1,0],
                                      [1,1,1,1],
                                      [1,1,1,1]]))
     assert_equal(tri(4,3,k=-2),array([[0,0,0],
                                       [0,0,0],
                                       [1,0,0],
                                       [1,1,0]]))
Example #3
0
 def test_basic(self):
     assert_equal(
         tri(4),
         array([[1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0], [1, 1, 1, 1]]))
     assert_equal(
         tri(4, dtype='f'),
         array([[1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0], [1, 1, 1, 1]],
               'f'))
 def test_diag2d(self):
     assert_equal(tri(3, 4, k=2), array([[1, 1, 1, 0],
                                         [1, 1, 1, 1],
                                         [1, 1, 1, 1]]))
     assert_equal(tri(4, 3, k=-2), array([[0, 0, 0],
                                          [0, 0, 0],
                                          [1, 0, 0],
                                          [1, 1, 0]]))
Example #5
0
 def test_2d(self):
     assert_equal(tri(4,3),array([[1,0,0],
                                  [1,1,0],
                                  [1,1,1],
                                  [1,1,1]]))
     assert_equal(tri(3,4),array([[1,0,0,0],
                                  [1,1,0,0],
                                  [1,1,1,0]]))
 def test_2d(self):
     assert_equal(tri(4, 3), array([[1, 0, 0],
                                    [1, 1, 0],
                                    [1, 1, 1],
                                    [1, 1, 1]]))
     assert_equal(tri(3, 4), array([[1, 0, 0, 0],
                                    [1, 1, 0, 0],
                                    [1, 1, 1, 0]]))
Example #7
0
 def test_diag(self):
     assert_equal(tri(4,k=1),array([[1,1,0,0],
                                    [1,1,1,0],
                                    [1,1,1,1],
                                    [1,1,1,1]]))
     assert_equal(tri(4,k=-1),array([[0,0,0,0],
                                     [1,0,0,0],
                                     [1,1,0,0],
                                     [1,1,1,0]]))
Example #8
0
 def test_basic(self):
     assert_equal(tri(4),array([[1,0,0,0],
                                [1,1,0,0],
                                [1,1,1,0],
                                [1,1,1,1]]))
     assert_equal(tri(4,dtype='f'),array([[1,0,0,0],
                                             [1,1,0,0],
                                             [1,1,1,0],
                                             [1,1,1,1]],'f'))
Example #9
0
 def time_tri(self, size):
     sl.tri(size)
Example #10
0
 def time_tri(self, size):
     sl.tri(size)