def tril(array, k=<NUM_LIT:0>):
try:<EOL><INDENT>tril_array = np.tril(array, k=k)<EOL><DEDENT>except:<EOL><INDENT>tril_array = np.zeros_like(array)<EOL>shape = array.shape<EOL>otherdims = shape[:-<NUM_LIT:2>]<EOL>for index in np.ndindex(otherdims):<EOL><INDENT>tril_array[index] = np.tril(array[index], k=k)<EOL><DEDENT><DEDENT>return tril_array<EOL>
Lower triangle of an array.
    Return a copy of an array with elements above the k-th diagonal zeroed.
    Need a multi-dimensional version here because numpy.tril does not
    broadcast for numpy verison < 1.9.