a = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12];

u0 = [1, 2, 3; 0, 5, 6; 0, 0, 9; 0, 0, 0];
u1 = [0, 2, 3; 0, 0, 6; 0, 0, 0; 0, 0, 0];
u2 = [0, 0, 3; 0, 0, 0; 0, 0, 0; 0, 0, 0];
u3 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 0, 0, 0];
um1 = [1, 2, 3; 4, 5, 6; 0, 8, 9; 0, 0, 12];
um2 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 0, 11, 12];
um3 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12];

(triu (a, -3) == um3 && triu (a, -2) == um2
 && triu (a, -1) == um1 && triu (a) == u0 && triu (a, 1) == u1
 && triu (a, 2) == u2 && triu (a, 3) == u3)
