Re: APL and (very) large arrays
- From: anon84c2@xxxxxxxxxxx (moses)
- Date: 13 Jan 2006 01:12:13 GMT
In article <Xns9749A028140E7ramacd@xxxxxxxxxxxxxx>,
Randy Macdonald <ramacd@xxxxxxxxxxx> wrote:
>"Stefano \"WildHeart\" Lanzavecchia" <wildstf@xxxxxxxxxxx> wrote in
>news:dq2gee$aqps$1@xxxxxxxxxxxxxxxxx:
>
>>> 2) The two biggest elements of a vector (for instance to build the
>>> associated Huffman code. Surely there must be a better way than
>>> sorting the whole vector and then making a 2 take ?
>>
>> As far as I know, there's no better way. You can avoid the finally
>> indexing by doing the 2 take of the index vector, but I cannot really
>> see how to improve the algorithm given the overhead of the
>> interpreter. Of course some cleverer guy will prove me wrong
>> straight-away. I mean: you could always
>> max1<-ceiling/vec
>> max2<-ceiling/vec without max1
>> but you would still have to traverse the original vector three times
>> and make one almost full one copy of it so, unless you timed it
>> against your favourite implementation, you wouldn't know if that would
>> be faster than the gradedown for any size of vec.
>
>Channeling Bill Nye*, I just did some timing tests, comparing the (a) 2
>take sort vs. (b) biggest,biggest without biggest. (b) won. Finding the
>biggest, even twice, seems faster than doing a complete sort.
>
>--
>* One test is worth a thousand expert opinions.
> -- Bill Nye, The Science Guy.
>--
>-----------------------------------------------------------------------
>|\/| Randy A MacDonald | you can't pay for it,
>|/\| ramacd@xxxxxxxxxxx | even if you want to.
>BSc(Math) UNBF'83 Sapere Aude | APL: If you can say it, it's done..
>Natural Born APL'er |
>----------------------------------------------------(INTP)----{ gnat }-
These methods will give different answers when the biggest is not unique.
.
- References:
- APL and (very) large arrays
- From: fda
- Re: APL and (very) large arrays
- From: Stefano \"WildHeart\" Lanzavecchia
- Re: APL and (very) large arrays
- From: Randy Macdonald
- APL and (very) large arrays
- Prev by Date: Re: Searching for the best position
- Next by Date: Re: Searching for the best position
- Previous by thread: Re: APL and (very) large arrays
- Next by thread: Re: APL and (very) large arrays
- Index(es):
Relevant Pages
|
|