ALPSCore reference
Main Page
Related Pages
Classes
Files
File List
File Members
alps
mc
random01.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3
* All rights reserved. Use is subject to license terms. See LICENSE.TXT
4
* For use in publications, see ACKNOWLEDGE.TXT
5
*/
6
7
#pragma once
8
9
#include <
alps/hdf5/archive.hpp
>
10
11
#include <boost/random.hpp>
12
13
#include <string>
14
#include <sstream>
15
16
namespace
alps
{
17
18
struct
random01
:
public
boost::variate_generator<boost::mt19937, boost::uniform_01<double> > {
19
random01
(
int
seed = 42)
20
:
boost
::variate_generator<
boost
::mt19937,
boost
::uniform_01<double> >(
boost
::mt19937(seed),
boost
::uniform_01<double>())
21
{}
22
23
void
save
(
alps::hdf5::archive
& ar)
const
{
// TODO: move this to hdf5 archive!
24
std::ostringstream os;
25
os << this->engine();
26
ar[
"engine"
] << os.str();
27
}
28
29
void
load
(
alps::hdf5::archive
& ar) {
// TODO: move this to hdf5 archive!
30
std::string state;
31
ar[
"engine"
] >> state;
32
std::istringstream is(state);
33
is >> this->engine();
34
}
35
};
36
37
}
archive.hpp
alps::random01::load
void load(alps::hdf5::archive &ar)
Definition:
random01.hpp:29
boost
Definition:
binning_analysis.cpp:21
alps::random01
Definition:
random01.hpp:18
alps::hdf5::archive
Definition:
archive.hpp:92
alps::random01::random01
random01(int seed=42)
Definition:
random01.hpp:19
alps::random01::save
void save(alps::hdf5::archive &ar) const
Definition:
random01.hpp:23
alps
Definition:
boost_array_functions.hpp:24
Generated on Sun Oct 14 2018 12:18:30 for ALPSCore reference by
1.8.11