Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
InitFunc.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012-2021 Euclid Science Ground Segment
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 3.0 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "SOM/InitFunc.h"
20#include <random>
21
22namespace Euclid {
23namespace SOM {
24namespace InitFunc {
25
26double zeroImpl(void) {
27 return 0;
28}
29
31
32Signature normalDistribution(double sigma, double mu) {
34 std::mt19937 gen(rd());
35 std::normal_distribution<> d(mu, sigma);
36 return [gen, d]() mutable { return d(gen); };
37}
38
39Signature uniformRandom(double min, double max) {
42 return [unif, re]() mutable { return unif(re); };
43}
44
45} // namespace InitFunc
46} // namespace SOM
47} // namespace Euclid
double zeroImpl(void)
Definition InitFunc.cpp:26
ELEMENTS_API Signature normalDistribution(double sigma, double mu)
Definition InitFunc.cpp:32
ELEMENTS_API Signature uniformRandom(double min, double max)
Definition InitFunc.cpp:39