The R Project SVN R

Rev

Rev 42302 | Rev 68947 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42302 Rev 42406
Line 1... Line 1...
1
/*
1
/*
2
 *  Mathlib : A C Library of Special Functions
2
 *  Mathlib : A C Library of Special Functions
3
 *  Copyright (C) 2000-6  The R Development Core Team
3
 *  Copyright (C) 2000-7  The R Development Core Team
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 20... Line 20...
20
 
20
 
21
#define MATHLIB_STANDALONE 1
21
#define MATHLIB_STANDALONE 1
22
#include <Rmath.h>
22
#include <Rmath.h>
23
 
23
 
24
#include <stdio.h>
24
#include <stdio.h>
-
 
25
typedef enum {
-
 
26
    BUGGY_KINDERMAN_RAMAGE,
-
 
27
    AHRENS_DIETER,
-
 
28
    BOX_MULLER,
-
 
29
    USER_NORM,
-
 
30
    INVERSION,
-
 
31
    KINDERMAN_RAMAGE
-
 
32
} N01type;
25
 
33
 
26
int
34
int
27
main(int argc, char** argv)
35
main(int argc, char** argv)
28
{
36
{
29
/* something to force the library to be included */
37
/* something to force the library to be included */
30
    qnorm(0.7, 0.0, 1.0, 0, 0);
38
    qnorm(0.7, 0.0, 1.0, 0, 0);
31
    printf("*** loaded '%s'\n", argv[0]);
39
    printf("*** loaded '%s'\n", argv[0]);
-
 
40
    set_seed(123, 456);
-
 
41
    N01_kind = AHRENS_DIETER;
-
 
42
    printf("one normal %f\n", norm_rand());
-
 
43
    set_seed(123, 456);
-
 
44
    N01_kind = BOX_MULLER;
-
 
45
    printf("normal via BM %f\n", norm_rand());
-
 
46
    
32
    return 0;
47
    return 0;
33
}
48
}