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 |
|
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. |
|
43 static ColumnVector state (void); |
|
44 |
|
45 // Set the current state/ |
|
46 static void state (const ColumnVector &s); |
|
47 |
4308
|
48 // Return the current distribution. |
|
49 static std::string distribution (void); |
|
50 |
|
51 // Set the current distribution. May be either "uniform" (the |
|
52 // default) or "normal". |
|
53 static void distribution (const std::string& d); |
|
54 |
|
55 static void uniform_distribution (void); |
|
56 |
|
57 static void normal_distribution (void); |
|
58 |
5730
|
59 static void exponential_distribution (void); |
|
60 |
|
61 static void poisson_distribution (void); |
|
62 |
|
63 static void gamma_distribution (void); |
|
64 |
4308
|
65 // Return the next number from the sequence. |
5730
|
66 static double scalar (double a = 1.); |
4308
|
67 |
|
68 // Return a matrix of numbers from the sequence, filled in column |
|
69 // major order. |
5730
|
70 static Matrix matrix (octave_idx_type r, octave_idx_type c, double a = 1.); |
4308
|
71 |
4543
|
72 // Return an N-dimensional array of numbers from the sequence, |
|
73 // filled in column major order. |
5730
|
74 static NDArray nd_array (const dim_vector& dims, double a = 1.); |
4543
|
75 |
4308
|
76 // Return an array of numbers from the sequence. |
5730
|
77 static Array<double> vector (octave_idx_type n, double a = 1.); |
4308
|
78 }; |
|
79 |
|
80 #endif |
|
81 |
|
82 /* |
|
83 ;;; Local Variables: *** |
|
84 ;;; mode: C++ *** |
|
85 ;;; End: *** |
|
86 */ |