I'm doing a level-by-level calculation of vectors from a previous "level" which is once again a list of vectors. I have a monad that produces a varying number of vectors from each vector in the previous level, and I take the new level to be the union of all of those vectors. This monad in fact never produces the 0-vector and I in fact tried the method of joining and filtering out zero-vectors with (#~ -.@:(-:&zeroVector) " 1), but it turned out to be over ten times slower than just using nextLevel =. ;@:(<@newFromWeight " 1). Could there be yet another method of doing this?
Also, what's the best way of maintaining a stack where the elements are of different lengths? Say I want to have a stack where one field is a vector, and the other is the sequence of group elements which, when they act on an initial vector, give the first? I've tried using boxes, which has been extremely slow, and I've tried maintaining two different stacks where the first stack is of vectors of the same length and in the second stack there are the sequences of generators. The sequences of generators have a maximum length and I can just take until I encounter the first 0. This would be useful for a depth-first approach to generating the vectors. On 7 September 2010 22:30, Sherlock, Ric <[email protected]> wrote: > I'd also encourage you to provide an example of the problem you want to solve > (ideally including example inputs & outputs), forum members may come up with > alternative solutions perhaps even some that don't require "0 > >> From: Dan Bron >> Sent: Wednesday, 8 September 2010 09:21 > ... >> >> That applies to J as well, though I would add an intermediate step "... >> complain on the Forums and see what answers you get first, ...". > ... >> >> -Dan >> >> >> Please excuse typos; composed on a handheld device. >> >> -----Original Message----- >> From: Justin Paston-Cooper <[email protected]> >> Sender: [email protected] >> Date: Tue, 7 Sep 2010 21:47:30 >> To: Programming forum<[email protected]> >> Reply-To: Programming forum <[email protected]> >> Subject: Re: [Jprogramming] Collecting Results >> >> Thanks a lot. I always forget about boxed lists. Applying ; to that >> gives exactly what I want. Is there any way to do it without boxing, >> though? This will be applied many times and I don't know how efficient >> this will be. >> >> On 7 September 2010 21:32, Dan Bron <[email protected]> wrote: >> > You want m&.> f . Note this is rank 0 already, so no reason for an >> explicit"0 . >> > >> > I'm on the road right now so I can't post a fuller explanation, but >> it might be understandable if you're told that <@m"0 f is equivalent, >> and that > is both scalar (rank zero) and an identity function on an >> open (non-boxed) noun. >> > >> > -Dan >> > >> > >> > >> > >> > Please excuse typos; composed on a handheld device. >> > >> > -----Original Message----- >> > From: Justin Paston-Cooper <[email protected]> >> > Sender: [email protected] >> > Date: Tue, 7 Sep 2010 21:09:37 >> > To: <[email protected]> >> > Reply-To: Programming forum <[email protected]> >> > Subject: [Jprogramming] Collecting Results >> > >> > Hello, >> > >> > Let's say I have a monad m " 0 and a 1-dimensional array f. The monad >> > returns 1-dimensional arrays of varying results which may include 0. >> I >> > would like to efficiently apply the monad m to array f and collect >> the >> > results returned by m in a 1-dimensional array. m f would not be >> > satisfactory because 0s may be added to the ends of the results which >> > are shorter than the longest result. Is this possible? Thanks for >> your >> > advice in advance. >> > --------------------------------------------------------------------- >> - >> > 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 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
