def check_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 check_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 check_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 check_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"))