JWS C Library
C language utility library
|
00001 /* 00002 * This work is licensed under a Creative Commons 00003 * Attribution-Noncommercial-Share Alike 3.0 United States License. 00004 * 00005 * http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 00006 * 00007 * You are free: 00008 * 00009 * to Share - to copy, distribute, display, and perform the work 00010 * to Remix - to make derivative works 00011 * 00012 * Under the following conditions: 00013 * 00014 * Attribution. You must attribute the work in the manner specified by the 00015 * author or licensor (but not in any way that suggests that they endorse you 00016 * or your use of the work). 00017 * 00018 * Noncommercial. You may not use this work for commercial purposes. 00019 * 00020 * Share Alike. If you alter, transform, or build upon this work, you may 00021 * distribute the resulting work only under the same or similar license to 00022 * this one. 00023 * 00024 * For any reuse or distribution, you must make clear to others the license 00025 * terms of this work. The best way to do this is by including this header. 00026 * 00027 * Any of the above conditions can be waived if you get permission from the 00028 * copyright holder. 00029 * 00030 * Apart from the remix rights granted under this license, nothing in this 00031 * license impairs or restricts the author's moral rights. 00032 */ 00033 00034 00046 #ifndef PMF_H 00047 #define PMF_H 00048 00049 00050 #include <jwsc/config.h> 00051 00052 #include <stdlib.h> 00053 #include <inttypes.h> 00054 00055 00056 #ifdef __cplusplus 00057 namespace jwsc { 00058 extern "C" { 00059 #endif 00060 00061 00070 float poisson_pmf_f(float lambda, uint32_t n); 00071 00073 double poisson_pmf_d(double lambda, uint32_t n); 00074 00086 uint32_t sample_poisson_pmf_f(float lambda, uint32_t a, uint32_t b); 00087 00089 uint32_t sample_poisson_pmf_d(double lambda, uint32_t a, uint32_t b); 00090 00102 float bernoulli_pmf_f(float p, uint32_t n); 00103 00105 double bernoulli_pmf_d(double p, uint32_t n); 00106 00118 uint8_t sample_bernoulli_pmf_f(float p); 00119 00121 uint8_t sample_bernoulli_pmf_d(double p); 00122 00134 float geometric_pmf_f(float p, uint32_t n); 00135 00137 double geometric_pmf_d(double p, uint32_t n); 00138 00150 float log_geometric_pmf_f(float p, uint32_t n); 00151 00153 double log_geometric_pmf_d(double p, uint32_t n); 00154 00166 uint32_t sample_geometric_pmf_f(float p); 00167 00169 uint32_t sample_geometric_pmf_d(double p); 00170 00174 #ifdef __cplusplus 00175 } 00176 } 00177 #endif 00178 00179 00180 #endif