Sacado Package Browser (Single Doxygen Collection)
Version of the Day
test
utils
Sacado_Random.hpp
Go to the documentation of this file.
1
// $Id$
2
// $Source$
3
// @HEADER
4
// ***********************************************************************
5
//
6
// Sacado Package
7
// Copyright (2006) Sandia Corporation
8
//
9
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
10
// the U.S. Government retains certain rights in this software.
11
//
12
// This library is free software; you can redistribute it and/or modify
13
// it under the terms of the GNU Lesser General Public License as
14
// published by the Free Software Foundation; either version 2.1 of the
15
// License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful, but
18
// WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
25
// USA
26
// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
27
// (etphipp@sandia.gov).
28
//
29
// ***********************************************************************
30
// @HEADER
31
32
#ifndef SACADO_RANDOM_HPP
33
#define SACADO_RANDOM_HPP
34
35
#include "
Sacado_ConfigDefs.h
"
36
37
#include <string>
38
39
namespace
Sacado
{
40
45
template
<
typename
ScalarT>
46
class
Random
{
47
public
:
48
50
Random
();
51
53
Random
(ScalarT a_, ScalarT b_);
54
56
Random
(ScalarT a_, ScalarT b_,
int
s);
57
59
~Random
();
60
62
void
setSeed
(
int
s);
63
65
ScalarT
number
();
66
67
protected
:
68
69
// Check seed is valid
70
int
checkSeed
(
const
std::string&
func
,
int
s);
71
72
protected
:
73
75
ScalarT
a
;
76
78
ScalarT
b
;
79
81
ScalarT
seed
;
82
83
};
// class Random
84
85
}
// namespace Sacdo
86
87
#ifdef HAVE_SACADO_COMPLEX
88
#include <complex>
89
90
namespace
Sacado
{
91
97
template
<
typename
T>
98
class
Random<
std
::complex<T> > {
99
public
:
100
102
Random
();
103
105
Random
(
const
std::complex<T>&
a
,
const
std::complex<T>&
b
);
106
108
Random
(
const
std::complex<T>&
a
,
const
std::complex<T>&
b
,
int
s);
109
111
~Random
();
112
114
void
setSeed
(
int
s);
115
117
std::complex<T>
number
();
118
119
protected
:
120
122
Random<T> rand_real;
123
125
Random<T> rand_imag;
126
127
};
// class Random
128
129
}
// namespace Sacado
130
131
#endif // HAVE_SACADO_COMPLEX
132
133
#include "
Sacado_RandomImp.hpp
"
134
135
#endif // SACADO_RANDOM_HPP
Sacado::Random
A random number generator that generates random numbers uniformly distributed in the interval (a,...
Definition:
Sacado_Random.hpp:46
Sacado::Random::b
ScalarT b
Upper bound of interval.
Definition:
Sacado_Random.hpp:78
Sacado::Random::Random
Random()
Constructor.
Definition:
Sacado_RandomImp.hpp:39
Sacado::Random::number
ScalarT number()
Get random number.
Definition:
Sacado_RandomImp.hpp:89
Sacado::Random::~Random
~Random()
Destructor.
Definition:
Sacado_RandomImp.hpp:73
Sacado
Definition:
Sacado_mpl_apply.hpp:39
Sacado::Random::checkSeed
int checkSeed(const std::string &func, int s)
Definition:
Sacado_RandomImp.hpp:100
Sacado_RandomImp.hpp
std
Sacado::Random::seed
ScalarT seed
Random number seed
Definition:
Sacado_Random.hpp:81
Sacado_ConfigDefs.h
func
const T func(int n, T *x)
Definition:
ad_example.cpp:49
Sacado::Random::a
ScalarT a
Lower bound of interval.
Definition:
Sacado_Random.hpp:75
Sacado::Random::setSeed
void setSeed(int s)
Set seed to s.
Definition:
Sacado_RandomImp.hpp:80
Generated by
1.8.16