[R-pkg-devel] R_orderVector1 - algo: radix, shell, or another?
Jan Gorecki
j@goreck| @end|ng |rom w|t@edu@p|
Tue Sep 26 10:08:21 CEST 2023
Thank you Ivan for all detail.
I was looking for particular algo for benchmarking purpose.
On Mon, Sep 25, 2023 at 9:26 AM Ivan Krylov <krylov.r00t using gmail.com> wrote:
> В Sun, 24 Sep 2023 10:38:41 +0200
> Jan Gorecki <j.gorecki using wit.edu.pl> пишет:
>
> >
> https://github.com/wch/r-source/blob/ed51d34ec195b89462a8531b9ef30b7b72e47204/src/main/sort.c#L1133
>
> > could anyone describe which one R_orderVector1 uses,
>
> The body of the sorting algorithm is defined in the sort2_with_index
> macro. This is shell sort. (I don't actually recognise sorting
> algorithms on sight, but the "sincs" array gave it away:
> <
> https://discourse.julialang.org/t/ironic-observation-about-sort-and-sortperm-speed-for-small-integers-vs-r/8715/3
> >.)
>
> > and if there is easy API to use different ones from C?
>
> No easy ones, I think. You could construct a call to order(..., method
> = 'radix') from R or bundle a sort implementation of your own.
>
> These are all undocumented implementation details. They could change in
> a new version of R (although quite a lot of it hasn't changed in 11-22
> years). Why are you looking for specific sorting algorithms? Could
> there be a better way to solve your problem?
>
> --
> Best regards,
> Ivan
>
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list