PSCF
v1.3
src
util
random
Ar1Process.h
1
#ifndef UTIL_AR1_PROCESS_H
2
#define UTIL_AR1_PROCESS_H
3
4
/*
5
* Util Package - C++ Utilities for Scientific Computation
6
*
7
* Copyright 2010 - 2017, The Regents of the University of Minnesota
8
* Distributed under the terms of the GNU General Public License.
9
*/
10
11
#include <util/random/Random.h>
12
#include <cmath>
13
14
namespace
Util
15
{
16
27
class
Ar1Process
28
{
29
30
public
:
31
35
Ar1Process
();
36
42
Ar1Process
(
Random
& random);
43
49
void
setRNG
(
Random
& random);
50
56
void
init
(
double
tau);
57
61
double
operator ()
();
62
63
private
:
64
65
double
x_;
66
67
double
B_;
68
69
double
C_;
70
71
Random
* randomPtr_;
72
73
bool
isInitialized_;
74
75
};
76
77
inline
double
Ar1Process::operator()
()
78
{
79
assert(isInitialized_);
80
x_ *= C_;
81
x_ += B_*randomPtr_->gaussian();
82
return
x_;
83
}
84
85
}
86
#endif
Util::Ar1Process::operator()
double operator()()
Generate and return a new value.
Definition
Ar1Process.h:77
Util::Ar1Process::init
void init(double tau)
Initialize process.
Definition
Ar1Process.cpp:46
Util::Ar1Process::setRNG
void setRNG(Random &random)
Associate a random number generator.
Definition
Ar1Process.cpp:38
Util::Ar1Process::Ar1Process
Ar1Process()
Constructor.
Definition
Ar1Process.cpp:16
Util::Random
Random number generator.
Definition
Random.h:47
Util
Utility classes for scientific computation.
Definition
accumulators.mod:1
Generated on
for PSCF by
1.14.0