Kairit,Be sure to be consistent with your ranks. Your noun c has vectors and scalars mixed up. I propose that you instead use:
C =: ,&.> c NB. (1 3 3;(,2);(,0);(,0)
Then the solution is trivial:
(,&.>c) ([: +/ =/)&> <i.#b
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
