Upper or right tri-mat:

utmfv=: 3 : 0
  bv=. ;<\.1,~0$~2-~-:>:%:>:4*+:#y
  |."1 bv |.;. 2 y
)

Lower or left tri-mat;

ltmfv=: 3 : 0
  bv=. ;<\1,0$~2-~-:>:%:>:4*+:#y
  bv ,;. 1 y
)

   utmfv 1+i.6
1 2 3
0 4 5
0 0 6

   ltmfv 1+i.6
1 0 0
2 3 0
4 5 6

It's a pity that 'utmfv' suffers from the double reversing.


=@@i


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to