Legofit
infers population history from nucleotide site patterns.
dtnorm.h
1
// Pseudorandom numbers from a truncated Gaussian distribution.
2
//
3
// This code was translated by Alan R. Rogers into C, based on the C++
4
// original written by G. Dolle and V Mazet, which is available at
5
// http://miv.u-strasbg.fr/mazet/rtnorm/rtnormCpp.zip
6
//
7
// This implements an extension of Chopin's algorithm detailed in
8
// N. Chopin, "Fast simulation of truncated Gaussian distributions",
9
// Stat Comput (2011) 21:275-288
10
//
11
// Copyright (C) 2012 Guillaume Dollé, Vincent Mazet
12
// (LSIIT, CNRS/Université de Strasbourg)
13
// Version 2012-07-04, Contact: vincent.mazet@unistra.fr
14
//
15
// 06/07/2012:
16
// - first launch of rtnorm.cpp
17
//
18
// Licence: GNU General Public License Version 2
19
// This program is free software; you can redistribute it and/or modify it
20
// under the terms of the GNU General Public License as published by the
21
// Free Software Foundation; either version 2 of the License, or (at your
22
// option) any later version. This program is distributed in the hope that
23
// it will be useful, but WITHOUT ANY WARRANTY; without even the implied
24
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
// GNU General Public License for more details. You should have received a
26
// copy of the GNU General Public License along with this program; if not,
27
// see http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
28
//
29
// Depends: LibGSL
30
// OS: Unix based system
31
32
33
#ifndef DTNORM_H
34
#define DTNORM_H
35
36
#include <gsl/gsl_rng.h>
37
38
// Pseudorandom numbers from a truncated Gaussian distribution The
39
// Gaussian has parameters mu (default 0) and sigma (default 1) and is
40
// truncated on the interval [a,b]. Returns the random variate x.
41
double
dtnorm
(
const
double
mu,
const
double
sigma,
double
a,
double
b,
42
gsl_rng *rng);
43
44
#endif
dtnorm
double dtnorm(const double mu, const double sigma, double a, double b, gsl_rng *rng)
Pseudorandom numbers from a truncated Gaussian distribution.
Definition:
dtnorm.c:67
Generated on Fri Mar 17 2023 17:45:47 for Legofit by
1.9.4