def _triangle2unit(tb, lower=0):
 if lower:
  d = tb[0].copy()
 else:
  d = tb[(-1)].copy()
 if lower:
  return (d, (tb / d))
 else:
  l = _upper2lower(tb)
  return (d, _lower2upper((l / d)))

def _triangle2unit ( tb , lower = 0 ) : if lower : d = tb [ 0 ] . copy ( ) else : d = tb [ ( - 1 ) ] . copy ( ) if lower : return ( d , ( tb / d ) ) else : l = _upper2lower ( tb ) return ( d , _lower2upper ( ( l / d ) ) )
take a banded triangular matrix and return its diagonal and the unit matrix: the banded triangular matrix with 1s on the diagonal .