def tri(N, M=None, k=0, dtype=None):
 if (M is None):
  M = N
 if isinstance(M, string_types):
  dtype = M
  M = N
 m = np.greater_equal(np.subtract.outer(np.arange(N), np.arange(M)), (- k))
 if (dtype is None):
  return m
 else:
  return m.astype(dtype)

def tri ( N , M = None , k = 0 , dtype = None ) : if ( M is None ) : M = N if isinstance ( M , string_types ) : dtype = M M = N m = np . greater_equal ( np . subtract . outer ( np . arange ( N ) , np . arange ( M ) ) , ( - k ) ) if ( dtype is None ) : return m else : return m . astype ( dtype )
construct matrix filled with ones at and below the k-th diagonal .