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]]))
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]]))
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]]))
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]]))
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]]))
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 time_tri(self, size): sl.tri(size)