annotate liboctave/oct-rand.h @ 5730:109fdf7b3dcb

[project @ 2006-04-03 19:18:26 by jwe]
author jwe
date Mon, 03 Apr 2006 19:18:26 +0000
parents 4c8a2e4e0717
children 143b556ce725
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
1 /*
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
2
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 2003 John W. Eaton
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
4
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
6
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
10 later version.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
11
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
15 for more details.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
16
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
5307
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5275
diff changeset
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5275
diff changeset
20 02110-1301, USA.
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
21
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
22 */
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
23
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
24 #if !defined (octave_rand_h)
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
25 #define octave_rand_h 1
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
26
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
27 #include <string>
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
28
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
29 #include "dColVector.h"
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
30 #include "dMatrix.h"
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4308
diff changeset
31 #include "dNDArray.h"
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
32
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
33 struct
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
34 octave_rand
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
35 {
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
36 // Return the current seed.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
37 static double seed (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
38
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
39 // Set the seed.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
40 static void seed (double s);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
41
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
42 // Return the current state.
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
43 static ColumnVector state (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
44
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
45 // Set the current state/
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
46 static void state (const ColumnVector &s);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
47
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
48 // Return the current distribution.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
49 static std::string distribution (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
50
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
51 // Set the current distribution. May be either "uniform" (the
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
52 // default) or "normal".
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
53 static void distribution (const std::string& d);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
54
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
55 static void uniform_distribution (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
56
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
57 static void normal_distribution (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
58
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
59 static void exponential_distribution (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
60
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
61 static void poisson_distribution (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
62
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
63 static void gamma_distribution (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
64
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
65 // Return the next number from the sequence.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
66 static double scalar (double a = 1.);
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
67
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
68 // Return a matrix of numbers from the sequence, filled in column
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
69 // major order.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
70 static Matrix matrix (octave_idx_type r, octave_idx_type c, double a = 1.);
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
71
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4308
diff changeset
72 // Return an N-dimensional array of numbers from the sequence,
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4308
diff changeset
73 // filled in column major order.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
74 static NDArray nd_array (const dim_vector& dims, double a = 1.);
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4308
diff changeset
75
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
76 // Return an array of numbers from the sequence.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
77 static Array<double> vector (octave_idx_type n, double a = 1.);
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
78 };
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
79
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
80 #endif
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
81
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
82 /*
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
83 ;;; Local Variables: ***
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
84 ;;; mode: C++ ***
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
85 ;;; End: ***
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
86 */