Okay, bear with me - I'm 2 days into J programming...

I have a (large) dataset, A,  which contains n columns, the first a number
in {1,2,...,m_1}, the
second a number in {1,2,...,m_2}, and so on.  I then have a second dataset,
B,  which contains
all the possible permutations.  As a simple example, set n=2, m_1=2 and
m_2=3.  Then B is

     1 1
     1 2
     1 3
     2 1
     2 2
     2 3

Let's also say that A is

     2 1
     2 2
     1 3
     2 1
     2 1
     1 2
     1 1

(but, again, I will typically have many more rows than this for A).  I was
hoping I could do
something like A = tr(B), or:

     2 1 = (1 1) (1 2) (1 3) (2 1) (2 2) (2 3)
     2 2 = (1 1) (1 2) (1 3) (2 1) (2 2) (2 3)
     1 3 = (1 1) (1 2) (1 3) (2 1) (2 2) (2 3)
     2 1 = (1 1) (1 2) (1 3) (2 1) (2 2) (2 3)
     2 1 = (1 1) (1 2) (1 3) (2 1) (2 2) (2 3)
     1 2 = (1 1) (1 2) (1 3) (2 1) (2 2) (2 3)
     1 1 = (1 1) (1 2) (1 3) (2 1) (2 2) (2 3)

which would give:

     0 0 0 1 0 0
     0 0 0 0 1 0
     0 0 1 0 0 0
     0 0 0 1 0 0
     0 0 0 1 0 0
     0 1 0 0 0 0
     1 0 0 0 0 0

I have tried several approaches, but can't quite get there.  Any suggestions
would be much
appreciated...


Thanks

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

Reply via email to