star-sp

Random number generators and distributions
git clone git://git.meso-star.fr/star-sp.git
Log | Files | Refs | README | LICENSE

commit 6dfba29cb4054233ab6deb5fa81fb6023d82419e
parent 47102f3c8e342e35326a71b6bec2030008fdf995
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri,  8 Jul 2016 17:29:12 +0200

Add missing license header

Diffstat:
Msrc/ssp_distributions.cpp | 47+++++++++++++++++++++++++++++++++++++++--------
1 file changed, 39 insertions(+), 8 deletions(-)

diff --git a/src/ssp_distributions.cpp b/src/ssp_distributions.cpp @@ -1,3 +1,34 @@ +/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com) + * + * This software is a library whose purpose is to generate [pseudo] random + * numbers and random variates. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. */ + #include <rsys/mem_allocator.h> #include <rsys/ref_count.h> #include <rsys/dynamic_array_double.h> @@ -5,12 +36,11 @@ #include "ssp_rng_c.h" - /******************************************************************************* * Gaussian distribution utilities ******************************************************************************/ -using normal_dist=RAN_NAMESPACE::normal_distribution<double>; +using normal_dist = RAN_NAMESPACE::normal_distribution<double>; struct ssp_ranst_gaussian { @@ -39,7 +69,7 @@ gaussian_release(ref_T* ref) * Piecewise linear distribution utilities ******************************************************************************/ -using piecewise_dist=RAN_NAMESPACE::piecewise_linear_distribution<double>; +using piecewise_dist = RAN_NAMESPACE::piecewise_linear_distribution<double>; struct ssp_ranst_piecewise_linear { @@ -75,7 +105,7 @@ struct ssp_ranst_discrete { }; static void -ran_discrete_release(ref_T* ref) +discrete_release(ref_T* ref) { struct ssp_ranst_discrete* ran; ASSERT(ref); @@ -165,9 +195,9 @@ ssp_ranst_discrete_setup pdf[i] = weights[i]; } if (sum == 0) { - res = RES_BAD_ARG; - goto error; - } + res = RES_BAD_ARG; + goto error; + } sum = 1 / sum; for(i = 0; i < nweights; i++) { @@ -200,7 +230,7 @@ res_T ssp_ranst_discrete_ref_put(struct ssp_ranst_discrete* ran) { if(!ran) return RES_BAD_ARG; - ref_put(&ran->ref, ran_discrete_release); + ref_put(&ran->ref, discrete_release); return RES_OK; } @@ -403,3 +433,4 @@ ssp_ranst_piecewise_linear_get class rng_cxx r(*rng); return ran->distrib->operator()(r); } +