SCM

SCM Repository

[rmetrics] Annotation of /pkg/randtoolbox/src/init.c
ViewVC logotype

Annotation of /pkg/randtoolbox/src/init.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4236 - (view) (download) (as text)

1 : dutangc 4229 /**
2 :     * @file init.c
3 :     * @brief init file for all RNGs
4 :     *
5 :     * @author Christophe Dutang
6 :     * @author Petr Savicky
7 :     *
8 :     *
9 :     * Copyright (C) 2009, Christophe Dutang,
10 :     * Petr Savicky, Academy of Sciences of the Czech Republic.
11 :     * All rights reserved.
12 :     *
13 :     * The new BSD License is applied to this software.
14 :     * Copyright (c) 2009 Christophe Dutang, Petr Savicky.
15 :     * All rights reserved.
16 :     *
17 :     * Redistribution and use in source and binary forms, with or without
18 :     * modification, are permitted provided that the following conditions are
19 :     * met:
20 :     *
21 :     * - Redistributions of source code must retain the above copyright
22 :     * notice, this list of conditions and the following disclaimer.
23 :     * - Redistributions in binary form must reproduce the above
24 :     * copyright notice, this list of conditions and the following
25 :     * disclaimer in the documentation and/or other materials provided
26 :     * with the distribution.
27 :     * - Neither the name of the Academy of Sciences of the Czech Republic
28 :     * nor the names of its contributors may be used to endorse or promote
29 :     * products derived from this software without specific prior written
30 :     * permission.
31 :     *
32 :     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 :     * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 :     * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 :     * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 :     * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37 :     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38 :     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
39 :     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
40 :     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41 :     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42 :     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 :     *
44 :     */
45 : dutangc 4236 /*****************************************************************************
46 : dutangc 4229 * randtoolbox to generate pseudo and quasi random sequences
47 : dutangc 3644 *
48 :     * init file
49 :     *
50 :     * Native routines registration, see 'writing R extensions'
51 :     *
52 :     */
53 :    
54 :     #include <Rinternals.h>
55 :     #include <R_ext/Rdynload.h>
56 :     #include "randtoolbox.h"
57 :     #include "testrng.h"
58 :    
59 :     //table of registration
60 :     static const R_CallMethodDef callMethods[] =
61 :     {
62 :     {"doTorus", (DL_FUNC) &doTorus, 6},
63 :     {"doSetSeed", (DL_FUNC) &doSetSeed, 1},
64 :     {"doCongruRand", (DL_FUNC) &doCongruRand, 6},
65 :     {"doSFMersenneTwister", (DL_FUNC) &doSFMersenneTwister, 4},
66 :     {"doPokerTest", (DL_FUNC) &doPokerTest, 3},
67 :     {"doCollisionTest", (DL_FUNC) &doCollisionTest, 3},
68 :     {"doWELL", (DL_FUNC) &doWELL, 5},
69 :     {"doKnuthTAOCP", (DL_FUNC) &doKnuthTAOCP, 2},
70 :     {NULL, NULL, 0}
71 :     };
72 :    
73 : dutangc 4229
74 :     //table of registered routines
75 : dutangc 3644 void R_init_randtoolbox(DllInfo *info)
76 :     {
77 :     //register method accessed with .Call
78 :     R_registerRoutines(info, NULL, callMethods, NULL, NULL);
79 : dutangc 4229
80 : dutangc 3644 //make randtoolbox C functions available from other packages
81 :     R_RegisterCCallable("randtoolbox", "torus", (DL_FUNC) torus);
82 :     R_RegisterCCallable("randtoolbox", "setSeed", (DL_FUNC) setSeed);
83 :     R_RegisterCCallable("randtoolbox", "congruRand", (DL_FUNC) congruRand);
84 :     R_RegisterCCallable("randtoolbox", "SFmersennetwister", (DL_FUNC) SFmersennetwister);
85 :     R_RegisterCCallable("randtoolbox", "pokerTest", (DL_FUNC) pokerTest);
86 :     R_RegisterCCallable("randtoolbox", "collisionTest", (DL_FUNC) collisionTest);
87 : dutangc 4229 R_RegisterCCallable("randtoolbox", "knuthTAOCP", (DL_FUNC) knuthTAOCP);
88 :    
89 :     //retrieve WELL rng entry point in the rngWELL pkg
90 :     WELLrng = (void (*) (double *, int, int, int, int, int)) R_GetCCallable("rngWELL", "WELLrng");
91 :    
92 : dutangc 3644 }
93 : dutangc 4229
94 :    
95 :    

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge