Simpler: P1 <@,."1 P2
On Wed, Apr 30, 2014 at 8:22 AM, Joe Bogner <[email protected]> wrote: > Roger, thank you. That is perfect. Also, I appreciate the tip on Dyadic ". > > Your clue gave me another idea, which isn't as simple as yours > > arr-: <"2 (P1 ,."1 P2) > > 1 > > > I typically forget about atop and just move the verb outside and use > parentheses. This will help it stick. > > > > > > On Wed, Apr 30, 2014 at 11:13 AM, Roger Hui <[email protected] > >wrote: > > > Dyadic ". is more efficient for converting strings to numbers. e.g. > > > > p2 =: _999 ". ];._2 (0 : 0) > > 32130.00 0.01369 1.00568 > > 32130.00 0.51354 1.00000 > > 32130.00 0.31124 1.00000 > > 32130.00 0.00591 1.00000 > > 32130.00 0.15562 1.00000 > > ) > > > > > > > > > > On Wed, Apr 30, 2014 at 8:00 AM, Joe Bogner <[email protected]> wrote: > > > > > I'm trying to combine/stitch two matrices into a boxed representation. > I > > > tried various ideas for about 45 minutes and this is the best I came up > > > with. > > > > > > I need the data to be boxed for another algorithm I'm supplying it to > > > > > > The output should be a 5 item list of boxed 3x2 arrays with each column > > > side by side from for each row (3 columns for 2 matrices). > > > > > > P1 =: "., ;._2 (0 : 0) > > > > > > 32658.00 0.029641 1.00 > > > > > > 32658.00 0.505236 1.00 > > > > > > 32658.00 0.306204 1.00 > > > > > > 32658.00 0.005818 1.00 > > > > > > 32658.00 0.153102 1.00 > > > > > > ) > > > > > > > > > P2 =: "., ;._2 (0 : 0) > > > > > > 32130.00 0.01369 1.00568 > > > > > > 32130.00 0.51354 1.00000 > > > > > > 32130.00 0.31124 1.00000 > > > > > > 32130.00 0.00591 1.00000 > > > > > > 32130.00 0.15562 1.00000 > > > > > > ) > > > > > > > > > ] arr=: |: each <"2 > _3 <\"1 (P1,.P2) > > > > > > > > > > > > > > > ┌────────────────┬────────────────┬────────────────┬────────────────┬────────────────┐ > > > > > > │ 32658 32130│ 32658 32130│ 32658 32130│ 32658 32130│ 32658 32130│ > > > > > > │0.029641 0.01369│0.505236 0.51354│0.306204 0.31124│0.005818 > > > 0.00591│0.153102 0.15562│ > > > > > > │ 1 1.00568│ 1 1│ 1 1│ 1 1│ 1 1│ > > > > > > > > > > > > └────────────────┴────────────────┴────────────────┴────────────────┴────────────────┘ > > > > > > > > > NB. A test case / check figure > > > > > > +/ > */ each arr > > > > > > 32658 32132.5 > > > > > > > > > This is the first box: > > > > > > > > > > 0{"1 arr > > > > > > 32658 32130 > > > > > > 0.029641 0.01369 > > > > > > 1 1.00568 > > > > > > > > > It feels like this is a fairly common operation so I am guessing > there's > > a > > > simpler way than this: > > > > > > > > > ] arr=: |: each <"2 > _3 <\"1 (P1,.P2) > > > > > > > > > Thanks for any alternate ideas. > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
