[RsR] estimators based on random samples... - should be random

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Tue May 9 08:51:46 CEST 2006


>>>>> "ValenT" == Valentin Todorov <valentin.todorov using chello.at>
>>>>>     on Tue, 9 May 2006 00:38:18 +0200 writes:

    ValenT> Ciao Claudio,
    >> I agree on the convention of R, i.e. to use the R random number generators
    >> and the set.seed() function to set the seed. Do you have
    >> any suggestions on how to implement/handling these functions from C and
    >> fortran; is there examples or documentation to take a look? (At least,
    >> for me, this is one of the reason I still use generators from outside R)

    ValenT> Some hints could be found in Writing R Extensions.

Well, for C, I think there's not just hints, but an extensive
documentation in the "Writing R Extensions" manual.
For Fortran, the manual says that you must write a C wrapper.
I've already done the latter for 'robustbase' though not
committed yet, nor implemented it for ltsReg() and covMCD().

By the way, Valentin,
do you feel it is important to remain with Fortran there?
In general, I end up 'f2c'ing (Fortran to C translating) Fortran
source and work with C; not the least because I get better
compiler warnings and easier debugging tools.

    ValenT> I have built a very simple, Hello World type package
    ValenT> with C and Fortran calls of the R random generator -
    ValenT> www.het2.org/~valentin/rhello_1.0.tar.gz Check the
    ValenT> functions userndC() and userndF().

Thank you, Valentin, that can be useful for less experienced
people.  Maybe you could make this into a small package  'fortranDemo'
and submit that to CRAN?

    ValenT> Unfortunately this is not guaranteed to be portable
    ValenT> across systems and I have only tested on Windows.

But it is the approach I will use as well for robustbase
(at least as long as we still have Fortran as opposed to C
sources) and I think it works portably at least for "usual
setups" (e.g. GNU compilers and libraries).

Martin

    ValenT> HTH
    ValenT> best regards,
    ValenT> valentin




More information about the R-SIG-Robust mailing list