Skip to content

Commit ed20942

Browse files
authored
Merge pull request #94 from zoj613/version
2 parents 0ada9d4 + f676a18 commit ed20942

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ of multi-dimensional samples without specifying the size.
4242
existing libraries.
4343
- `polyagamma` is optimized for performance and tests show that it is faster
4444
than other implementations.
45-
- Pre-built wheels are provided for easy installation on `x86_64` linux systems.
45+
- Pre-built wheels are provided for easy installation on Linux, MacOS and Windows.
4646

4747

4848
## Examples
@@ -165,7 +165,9 @@ and the following shell commands:
165165
```shell
166166
$ git clone https://github.com/zoj613/polya-gamma.git
167167
$ cd polya-gamma/
168-
$ poetry install
168+
# install dependencies
169+
$ poetry install --no-root
170+
$ make install
169171
# add package to python's path
170172
$ export PYTHONPATH=$PWD:$PYTHONPATH
171173
```
@@ -196,7 +198,7 @@ method and also equally accurate).
196198
Therefore, we devise a "hybrid/default" sampler that picks a sampler based on the above guidelines.
197199

198200
We also benchmark the hybrid sampler runtime with the sampler found in the `pypolyagamma`
199-
package (version `1.2.3`). The version of NumPy we use is `1.18.5`. We compare our
201+
package (version `1.2.3`). The version of NumPy we use is `1.19.0`. We compare our
200202
sampler to the `pgdrawv` functions provided by the package. Below are runtime plots of 20000
201203
samples for each value of `h` and `z`. Values of `h` range from 0.1 to 50, while `z` is set
202204
to 0, 2.5, 5, and 10.

polyagamma/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
polyagamma as random_polyagamma, polyagamma_pdf, polyagamma_cdf
33
)
44

5-
__version__ = '1.3.1'
5+
__version__ = '1.3.2-beta.2'

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "polyagamma"
3-
version = "1.3.1"
3+
version = "1.3.2-beta.2"
44
description = "Efficiently generate samples from the Polya-Gamma distribution using a NumPy/SciPy compatible interface."
55
authors = ["Zolisa Bleki"]
66
license = "BSD-3-Clause"
@@ -14,7 +14,9 @@ classifiers = [
1414
"Programming Language :: C",
1515
"Programming Language :: Python",
1616
"Programming Language :: Python :: 3 :: Only",
17-
"Operating System :: Unix",
17+
"Operating System :: POSIX :: Linux",
18+
"Operating System :: Microsoft :: Windows :: Windows 10",
19+
"Operating System :: MacOS :: MacOS X",
1820
"Typing :: Typed",
1921
]
2022
packages = [{include = "polyagamma/*.py"}]

src/pgm_random.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* SPDX-License-Identifier: BSD-3-Clause */
44
#include "../include/pgm_random.h"
55

6-
#if defined(__GNUC__) || defined(__clang__)
6+
#if defined(_MSC_VER)
7+
#define PGM_INLINE __inline
8+
#elif defined(__GNUC__) || defined(__clang__)
79
#define PGM_INLINE inline
810
#else
911
#define PGM_INLINE
@@ -28,13 +30,13 @@ random_polyagamma_saddle(bitgen_t* bitgen_state, double h, double z,
2830

2931
/* libc math library forward declarations */
3032
double
31-
sinh(double __x);
33+
sinh(double x);
3234
double
33-
tanh(double __x);
35+
tanh(double x);
3436
double
35-
sqrt(double __x);
37+
sqrt(double x);
3638
double
37-
fabs(double __x);
39+
fabs(double x);
3840

3941
/*
4042
* Sample from a PG(h. z) using a Normal Approximation. For sufficiently large
@@ -72,7 +74,7 @@ random_polyagamma_normal_approx(bitgen_t* bitgen_state, double h, double z,
7274
#endif
7375

7476
void*
75-
memset(void* __s, int __c, size_t __n);
77+
memset(void* s, int c, size_t n);
7678
/*
7779
* Sample from PG(h, z) using the Gamma convolution approximation method.
7880
*
@@ -126,7 +128,7 @@ random_polyagamma_hybrid(bitgen_t* bitgen_state, double h, double z,
126128
typedef void
127129
(*pgm_func_t)(bitgen_t* bitgen_state, double h, double z, size_t n, double* out);
128130

129-
const pgm_func_t sampling_method_table[] = {
131+
static const pgm_func_t sampling_method_table[] = {
130132
[ALTERNATE] = random_polyagamma_alternate,
131133
[DEVROYE] = random_polyagamma_devroye,
132134
[SADDLE] = random_polyagamma_saddle,
@@ -135,7 +137,7 @@ const pgm_func_t sampling_method_table[] = {
135137
};
136138

137139

138-
PGM_INLINE double
140+
double
139141
pgm_random_polyagamma(bitgen_t* bitgen_state, double h, double z, sampler_t method)
140142
{
141143
double out;
@@ -145,15 +147,15 @@ pgm_random_polyagamma(bitgen_t* bitgen_state, double h, double z, sampler_t meth
145147
}
146148

147149

148-
PGM_INLINE void
150+
void
149151
pgm_random_polyagamma_fill(bitgen_t* bitgen_state, double h, double z,
150152
sampler_t method, size_t n, double* out)
151153
{
152154
sampling_method_table[method](bitgen_state, h, z, n, out);
153155
}
154156

155157

156-
PGM_INLINE void
158+
void
157159
pgm_random_polyagamma_fill2(bitgen_t* bitgen_state, const double* h, const double* z,
158160
sampler_t method, size_t n, double* restrict out)
159161
{

0 commit comments

Comments
 (0)