[Haskell-cafe] vector to uvector and back again

Dan Doel dan.doel at gmail.com
Thu Feb 11 20:54:15 EST 2010


On Thursday 11 February 2010 12:43:10 pm stefan kersten wrote:
> On 10.02.10 19:03, Bryan O'Sullivan wrote:
> > I'm thinking of switching the statistics library over to using vector.
> 
> that would be even better of course! an O(0) solution, at least for me ;)
> let me know if i can be of any help (e.g. in testing). i suppose
> uvector-algorithms would also need to be ported to vector, then.

I could do this. I've been occupied with things other than uvector-algorithms 
for a while, but I've been meaning to get back into it (perhaps finally get 
timsort in there).

How widespread is the consensus on vector over uvector? dons seems to have 
added to uvector as recently as mid December, so I'm not really sure how bit 
rotted it is. But vector seems to have a lot more going on in it, including 
boxed arrays, which I suppose is a gap in using uvector.

I also notice that vector seems to have discarded the idea of

  Vec (A * B) = Vec A * Vec B

with associated types. Was this determined to not be worth it? uvector-
algorithms actually used the fact for a cute trick (Schwartzian transform can 
be done for such arrays by computing a new array containing 'f e' for each 'e' 
in the original array, pairing up the two arrays, and performing an algorithm 
that only looks at the 'f e' half, and then pulling the 'e' half out of the 
pair; doing it this way requires no copying of the original array).

Anyhow, if vector is the clear way forward, I don't mind porting uvector-
algorithms. But I don't relish maintaining two slightly different parallel 
branches.

-- Dan


More information about the Haskell-Cafe mailing list