Mercurial > octave-nkf
comparison liboctave/randmtzig.h @ 14655:43db83eff9db
Implement single precision rand, randn, rande, randg and randp generators (bug #34351, #36293)
* oct-rand.cc (octave_rand:do_matrix): Remove method.
(octave_rand::do_float_scalar, octave_rand::do_float_nd_array,
octave_rand::do_float_vector): New methods.
* oct-rand.h (octave_rand:do_matrix, octave_rand::matrix): Remove methods.
(octave_rand::do_float_scalar, octave_rand::do_float_nd_array,
octave_rand::do_float_vector, octave_rand::float_scalar,
octave_rand::do_nd_array, octave_rand::float_vector): Declare new methods.
* randgamma.c (oct_fill_float_randg, oct_float_randg): New functions.
* randgamma.h (oct_fill_float_randg, oct_float_randg): Declare new functions.
* randpoisson.c (oct_fill_float_randp, oct_float_randp): New functions.
(poisson_cdf_lookup_float, poisson_rejection_float): New static functions.
* randpoisson.h (oct_fill_float_randp, oct_float_randp): Declare new functions.
* randmtzig.c (randu64) : Remove static function.
(ALLBITS): Remove compile flag logic.
(randu32): Change return type to float.
(oct_float_randu, oct_float_randn, oct_float_rande, oct_fill_float_randu,
oct_fill_float_randn, oct_fill_float_rande): New functions.
(create_ziggurat_float_tables): New static function.
* randmtzig.h (oct_float_randu, oct_float_randn, oct_float_rande,
oct_fill_float_randu, oct_fill_float_randn, oct_fill_float_rande):
Declare new functions.
* rand.cc (do_rand): Add logic to parse "double" or "single" as final argument.
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sat, 19 May 2012 00:14:59 +0200 |
parents | 72c96de7a403 |
children |
comparison
equal
deleted
inserted
replaced
14654:389f49a88656 | 14655:43db83eff9db |
---|---|
80 /* === Array generators === */ | 80 /* === Array generators === */ |
81 extern OCTAVE_API double oct_randu (void); | 81 extern OCTAVE_API double oct_randu (void); |
82 extern OCTAVE_API double oct_randn (void); | 82 extern OCTAVE_API double oct_randn (void); |
83 extern OCTAVE_API double oct_rande (void); | 83 extern OCTAVE_API double oct_rande (void); |
84 | 84 |
85 extern OCTAVE_API float oct_float_randu (void); | |
86 extern OCTAVE_API float oct_float_randn (void); | |
87 extern OCTAVE_API float oct_float_rande (void); | |
88 | |
85 /* === Array generators === */ | 89 /* === Array generators === */ |
86 extern OCTAVE_API void oct_fill_randu (octave_idx_type n, double *p); | 90 extern OCTAVE_API void oct_fill_randu (octave_idx_type n, double *p); |
87 extern OCTAVE_API void oct_fill_randn (octave_idx_type n, double *p); | 91 extern OCTAVE_API void oct_fill_randn (octave_idx_type n, double *p); |
88 extern OCTAVE_API void oct_fill_rande (octave_idx_type n, double *p); | 92 extern OCTAVE_API void oct_fill_rande (octave_idx_type n, double *p); |
89 | 93 |
94 extern OCTAVE_API void oct_fill_float_randu (octave_idx_type n, float *p); | |
95 extern OCTAVE_API void oct_fill_float_randn (octave_idx_type n, float *p); | |
96 extern OCTAVE_API void oct_fill_float_rande (octave_idx_type n, float *p); | |
97 | |
90 #ifdef __cplusplus | 98 #ifdef __cplusplus |
91 } | 99 } |
92 #endif | 100 #endif |
93 #endif | 101 #endif |