Joe,

When you have a dyadic verb (one which takes both a left and a right argument), 
and you want to apply that verb to different size pieces ("cells") of the 
arguments, use the rank conjunction  "  .  

In your case, you want to pair the rows of the left argument with the table of 
the right argument.  Rows have one dimension, and so are rank  1  ,  tables 
have two dimensions, and so are rank  2  .  Consequently, you want to do:


                short_data =: }:"1 data                  


                short_data  x"1 2  yuvmat


which results in an  N  by  3  table, where  N  is  #data  .  I, personally, 
would write:


                short_data  x"_1 _  yuvmat


which means "pair the /items/ of the left argument with the /entire/ of the 
right argument.".  The items of  short_data  happen to be rows, and the entire 
of  yuvmat  happens to be a table.  The results are unchanged.  

Essentially, what  "  does is pair up the requested parts ("cells") of the two 
arguments, then applies the verb between them.  That is, for each item (row) in 
short_data, it takes a copy of the entire (table) yuvmat, and matrix-multiplies 
the two.  You can experiment with other cells:

                show_pairings =: ,&:<

                short_data   show_pairings"1 2    yuvmat
                short_data   show_pairings"_1 _   yuvmat
                short_data   show_pairings"0 2    yuvmat
                short_data   show_pairings"1 0    yuvmat


Hope this helps,
  
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to