annotate liboctave/oct-rand.h @ 6469:a848b846cb3a ss-2-9-10

[project @ 2007-03-27 18:42:11 by jwe]
author jwe
date Tue, 27 Mar 2007 18:42:11 +0000
parents 143b556ce725
children 93c65f2a5668
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
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5730
diff changeset
34 OCTAVE_API
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
35 octave_rand
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
36 {
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
37 // Return the current seed.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
38 static double seed (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
39
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
40 // Set the seed.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
41 static void seed (double s);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
42
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
43 // Return the current state.
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
44 static ColumnVector state (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
45
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
46 // Set the current state/
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
47 static void state (const ColumnVector &s);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
48
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
49 // Return the current distribution.
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
50 static std::string distribution (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
51
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
52 // Set the current distribution. May be either "uniform" (the
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
53 // default) or "normal".
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
54 static void distribution (const std::string& d);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
55
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
56 static void uniform_distribution (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
57
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
58 static void normal_distribution (void);
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
59
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
60 static void exponential_distribution (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
61
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
62 static void poisson_distribution (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
63
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
64 static void gamma_distribution (void);
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
65
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
66 // Return the next number from the sequence.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
67 static double scalar (double a = 1.);
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
68
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
69 // 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
70 // major order.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
71 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
72
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4308
diff changeset
73 // 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
74 // filled in column major order.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
75 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
76
4308
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
77 // Return an array of numbers from the sequence.
5730
109fdf7b3dcb [project @ 2006-04-03 19:18:26 by jwe]
jwe
parents: 5307
diff changeset
78 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
79 };
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
80
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
81 #endif
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 /*
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
84 ;;; Local Variables: ***
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
85 ;;; mode: C++ ***
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
86 ;;; End: ***
b738d1a02adb [project @ 2003-01-24 19:37:12 by jwe]
jwe
parents:
diff changeset
87 */