Well done Tim! On Tue, Mar 29, 2011 at 5:39 PM, Timothy Potter <thelabd...@gmail.com>wrote:
> Hi Jake, > > Success! I implemented a basic Element Comparator and sorted the random > vector data before adding to the SequentialAccessSparseVector as you > recommended and the TransposeJob ripped through my data in about 5 mins! My > implementation is basic at this point relying on a custom > Comparator<Element> and Arrays.sort() vs. the optimal way you suggested, but > gets the job done and is actually pretty fast ... I'll post a patch after > I've added some test cases for this. > > Thanks again for your help. > > Cheers, > Tim > > On Tue, Mar 29, 2011 at 7:29 AM, Jake Mannix <jake.man...@gmail.com>wrote: > >> Riding in the cab to the airport, I just realized that this makes the >> perfect interview question: the optimal way to do this constructor only >> makes two new primitive arrays, and forces you to essentially reimplement >> the basic in-place sort of the java library - you can't reuse the one in >> Arrays or Collections because you do want it to act on two arrays at once. >> >> I always feel guilty having people reimplement sort(), but here you >> basically have to! In the real world, you can cut and paste, but it gives a >> totally plausible backstory to the question in an interview. >> >> -jake >> >> On Mar 29, 2011 6:15 AM, "Timothy Potter" <thelabd...@gmail.com> wrote: >> >> Thanks for the pointer! >> >> I created issue #639 in JIRA to track this -- I'll refactor the code using >> Jake's suggestions and post a patch later today. >> >> https://issues.apache.org/jira/browse/MAHOUT-639 >> >> Best regards, >> Tim >> >> On Tue, Mar 29, 2011 at 12:37 AM, Jake Mannix <jake.man...@gmail.com> >> wrote: > > Suspicion confirm... >> >> >