Hmm... I thought you were suggesting the 2 3 4 array as input, not as result, if that's not the case, my question asking for an example was irrelevant.
As for my "neglected dimensions"... the ,/ operation flattens the first two dimensions of an array. I was reaching for a phrase to describe what it does (or doesn't do) to the remaining dimensions. Anyways, I guess that's all, for now. Thanks, -- Raul On Sat, Apr 13, 2019 at 10:16 AM Brian Schott <[email protected]> wrote: > > Raul, > > I have an alternative method for doing this which is based on a different > approach from im2col and mostly I just want to prove to myself the 2 > methods provide identical results. I have done that so, there is not much > reason to pursue this issue now. The different approach is detailed in sec > 4.1 at https://arxiv.org/pdf/1603.07285.pdf . (I am not suggesting you look > at this other link,btw.) I do not quite understand your '..."neglected" > dimensions ...', btw. > > Still, I thought my first post showed what I need by showing inputs and the > results I want. > I have reproduced those initial results just below to give you what I think > is the solved example. I am trying to provide im2col with a non-standard > (flattened matrice(s), singular as just a list initially, or plural as an > array of one or more matrices) input. > > *******reproduced from initial post (below)********* > > forcearray =: (($,)~_2{.1,$) > im2col =: (2 2$1 1 2 2) (|:"2@:(,;._3)"2) _4 ]\"1 ] > $,"1&>/"1<"2 im2col forcearray i.12 > 1 4 6 > $,"1&>/"1<"2 im2col forcearray i.2 12 > 2 4 6 > $,"1&>/"1<"2 im2col forcearray i.3 12 NB. etc > 3 4 6 > > ,"1&>/"1<"2 im2col forcearray i.2 12 > 0 1 2 4 5 6 > 1 2 3 5 6 7 > 4 5 6 8 9 10 > 5 6 7 9 10 11 > > 12 13 14 16 17 18 > 13 14 15 17 18 19 > 16 17 18 20 21 22 > 17 18 19 21 22 23 > ,"1&>/"1<"2 im2col forcearray i. 12 > 0 1 2 4 5 6 > 1 2 3 5 6 7 > 4 5 6 8 9 10 > 5 6 7 9 10 11 > *******reproduced from initial post (above)********* > > Thank you, > > On Sat, Apr 13, 2019 at 8:56 AM Raul Miller <[email protected]> wrote: > > > An you describe more specifically the transform you need with multiple > > matrices? > > > > And/or, can you work through an example where you’re using a 2 3 4 array? > > > > Ignore the code side of it, maybe, initially, if that’s getting in the way? > > > > (I am not quite seeing how im2col fits into this context. But it might be > > that you’ll want to use ,/;._3 with “neglected” dimensions moved so they’re > > left alone at that step?) > > > > Thanks, > > > > — > > Raul > > > > On Saturday, April 13, 2019, Brian Schott <[email protected]> wrote: > > > > > Raul, > > > > > > I like your ideas. You actually got a long way, despite your denial. > > > Please don't spend much time on my question, because I do have working > > > solution. > > > I don't know how to comment on what you are saying about the possible > > > transpose before the ,;._3 being possibly necessary. But such transposes > > > might simplify some of the other issues I am having with my inputs > > matching > > > the later gyrations I describe below. > > > > > > This simplified version of im2col based on your ideas works for me if > > there > > > is just one **matrix** argument. But, see further below, because my > > > argument is not just one matrix. > > > > > > im2col =: (1 1,:2 2)|:@(,/@(,;._3))] > > > im2col i. 3 4 > > > 0 1 2 4 5 6 > > > 1 2 3 5 6 7 > > > 4 5 6 8 9 10 > > > 5 6 7 9 10 11 > > > > > > > > > But, I think your forcematrix, or my forcearray, is needed because I am > > > supplying one or more *flattened* matrices as lists. So my input to > > im2col > > > is more like B =. i. 2 12 where each item of B is a flattened 3x4 matrix. > > > My previous machinations with boxing and unboxing was largely due to > > > restructuring each item of B to a matrix before giving it to im2col, and > > I > > > still have no simple way to do that and my approach requires ugly > > > processing even after the "sliding" of u;._3 . > > > > > > > > > I can't tell how to gracefully convert arguments like my B into arrays of > > > shapes like 2 3 4 before submitting them to an im2col with revised > > external > > > and internal ranks. Instead my previously posted im2col accepts arguments > > > like B and after the u,._3 reworks the result into the needed form. > > > > > > I think I prefer preprocessing the B into multiple matrices (an array) > > (as > > > suggested in the first sentence of the previous paragraph), but as I > > said, > > > I can't see how. > > > > > > Thanks, again, > > > > > > > > > > -- > (B=) > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
