Mercurial > hg > octave-nkf
annotate liboctave/oct-rand.h @ 11740:72830070a17b release-3-0-x
update copyright dates
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 07 Apr 2008 13:40:38 -0400 |
parents | a4d0680f4dda |
children |
rev | line source |
---|---|
4308 | 1 /* |
2 | |
11740 | 3 Copyright (C) 2003, 2005, 2006, 2007, 2008 John W. Eaton |
4308 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
4308 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
4308 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_rand_h) | |
24 #define octave_rand_h 1 | |
25 | |
26 #include <string> | |
27 | |
5730 | 28 #include "dColVector.h" |
4308 | 29 #include "dMatrix.h" |
4543 | 30 #include "dNDArray.h" |
4308 | 31 |
32 struct | |
6108 | 33 OCTAVE_API |
4308 | 34 octave_rand |
35 { | |
36 // Return the current seed. | |
37 static double seed (void); | |
38 | |
39 // Set the seed. | |
40 static void seed (double s); | |
41 | |
5730 | 42 // Return the current state. |
11662
a4d0680f4dda
save state separately for each MT random number generator
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
43 static ColumnVector state (const std::string& d = std::string ()); |
5730 | 44 |
45 // Set the current state/ | |
11662
a4d0680f4dda
save state separately for each MT random number generator
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
46 static void state (const ColumnVector &s, |
a4d0680f4dda
save state separately for each MT random number generator
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
47 const std::string& d = std::string ()); |
5730 | 48 |
4308 | 49 // Return the current distribution. |
50 static std::string distribution (void); | |
51 | |
52 // Set the current distribution. May be either "uniform" (the | |
11662
a4d0680f4dda
save state separately for each MT random number generator
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
53 // default), "normal", "exponential", "poisson", or "gamma". |
4308 | 54 static void distribution (const std::string& d); |
55 | |
56 static void uniform_distribution (void); | |
57 | |
58 static void normal_distribution (void); | |
59 | |
5730 | 60 static void exponential_distribution (void); |
61 | |
62 static void poisson_distribution (void); | |
63 | |
64 static void gamma_distribution (void); | |
65 | |
4308 | 66 // Return the next number from the sequence. |
5730 | 67 static double scalar (double a = 1.); |
4308 | 68 |
69 // Return a matrix of numbers from the sequence, filled in column | |
70 // major order. | |
5730 | 71 static Matrix matrix (octave_idx_type r, octave_idx_type c, double a = 1.); |
4308 | 72 |
4543 | 73 // Return an N-dimensional array of numbers from the sequence, |
74 // filled in column major order. | |
5730 | 75 static NDArray nd_array (const dim_vector& dims, double a = 1.); |
4543 | 76 |
4308 | 77 // Return an array of numbers from the sequence. |
5730 | 78 static Array<double> vector (octave_idx_type n, double a = 1.); |
4308 | 79 }; |
80 | |
81 #endif | |
82 | |
83 /* | |
84 ;;; Local Variables: *** | |
85 ;;; mode: C++ *** | |
86 ;;; End: *** | |
87 */ |