4308
|
1 /* |
|
2 |
|
3 Copyright (C) 2003 John W. Eaton |
|
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 |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
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 |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
4308
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_rand_h) |
|
25 #define octave_rand_h 1 |
|
26 |
|
27 #include <string> |
|
28 |
5730
|
29 #include "dColVector.h" |
4308
|
30 #include "dMatrix.h" |
4543
|
31 #include "dNDArray.h" |
4308
|
32 |
|
33 struct |
6108
|
34 OCTAVE_API |
4308
|
35 octave_rand |
|
36 { |
|
37 // Return the current seed. |
|
38 static double seed (void); |
|
39 |
|
40 // Set the seed. |
|
41 static void seed (double s); |
|
42 |
5730
|
43 // Return the current state. |
|
44 static ColumnVector state (void); |
|
45 |
|
46 // Set the current state/ |
|
47 static void state (const ColumnVector &s); |
|
48 |
4308
|
49 // Return the current distribution. |
|
50 static std::string distribution (void); |
|
51 |
|
52 // Set the current distribution. May be either "uniform" (the |
|
53 // default) or "normal". |
|
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 */ |