├── LICENSE
├── README.md
├── beta.html
├── beta_proportion.html
├── beta_unbounded.html
├── cauchy.html
├── chi_square.html
├── compile.sh
├── double_exponential.html
├── exp_mod_normal.html
├── exponential.html
├── frechet.html
├── gamma.html
├── gumbel.html
├── inv_chi_square.html
├── inv_gamma.html
├── logistic.html
├── lognormal.html
├── math-cpp
├── beta.cpp
├── beta_proportion.cpp
├── beta_unbounded.cpp
├── cauchy.cpp
├── chi_square.cpp
├── double_exponential.cpp
├── exp_mod_normal.cpp
├── exponential.cpp
├── frechet.cpp
├── gamma.cpp
├── gumbel.cpp
├── inv_chi_square.cpp
├── inv_gamma.cpp
├── logistic.cpp
├── lognormal.cpp
├── neg_binomial.cpp
├── neg_binomial_2.cpp
├── neg_binomial_2_log.cpp
├── normal.cpp
├── pareto.cpp
├── pareto_type_2.cpp
├── poisson.cpp
├── poisson_log.cpp
├── rayleigh.cpp
├── scaled_inv_chi_square.cpp
├── skew_double_exponential.cpp
├── skew_normal.cpp
├── std_normal.cpp
├── student_t.cpp
├── uniform.cpp
├── von_mises.cpp
├── weibull.cpp
└── wiener.cpp
├── math-js-wasm
├── beta.js
├── beta.wasm
├── beta_proportion.js
├── beta_proportion.wasm
├── beta_unbounded.js
├── beta_unbounded.wasm
├── cauchy.js
├── cauchy.wasm
├── chi_square.js
├── chi_square.wasm
├── double_exponential.js
├── double_exponential.wasm
├── exp_mod_normal.js
├── exp_mod_normal.wasm
├── exponential.js
├── exponential.wasm
├── frechet.js
├── frechet.wasm
├── gamma.js
├── gamma.wasm
├── gumbel.js
├── gumbel.wasm
├── inv_chi_square.js
├── inv_chi_square.wasm
├── inv_gamma.js
├── inv_gamma.wasm
├── logistic.js
├── logistic.wasm
├── lognormal.js
├── lognormal.wasm
├── neg_binomial.js
├── neg_binomial.wasm
├── neg_binomial_2.js
├── neg_binomial_2.wasm
├── neg_binomial_2_log.js
├── neg_binomial_2_log.wasm
├── normal.js
├── normal_lpdf.wasm
├── pareto.js
├── pareto.wasm
├── pareto_type_2.js
├── pareto_type_2.wasm
├── poisson.js
├── poisson.wasm
├── poisson_log.js
├── poisson_log.wasm
├── rayleigh.js
├── rayleigh.wasm
├── scaled_inv_chi_square.js
├── scaled_inv_chi_square.wasm
├── skew_double_exponential.js
├── skew_double_exponential.wasm
├── skew_normal.js
├── skew_normal.wasm
├── std_normal.js
├── std_normal.wasm
├── student_t.js
├── student_t.wasm
├── uniform.js
├── uniform.wasm
├── von_mises.js
├── von_mises.wasm
├── weibull.js
├── weibull.wasm
├── wiener.js
└── wiener.wasm
├── neg_binomial.html
├── neg_binomial_2.html
├── neg_binomial_2_log.html
├── normal.html
├── pareto.html
├── pareto_type_2.html
├── poisson.html
├── poisson_log.html
├── rayleigh.html
├── scaled_inv_chi_square.html
├── skew_double_exponential.html
├── skew_normal.html
├── stan-distribution-zoo.js
├── std_normal.html
├── student_t.html
├── style.css
├── uniform.html
├── von_mises.html
├── weibull.html
└── wiener.html
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2021, Rok Češnovar
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Stan distributions
2 |
3 | A web app to visualize distributions in Stan. It uses Stan Math C++ code to evaluate the log probability density/mass functions. The Stan Math C++ is compiled to Webassembly using [Emscripten](https://emscripten.org/index.html). [d3.js](https://d3js.org/) is used for visualizations.
4 |
5 | This was inspired by the [distribution zoo](https://github.com/ben18785/distribution-zoo). The main differences of this approach are:
6 | - it runs entirely in the user's browser and does not require a server (very easy to fork and deploy your own custom version),
7 | - it uses the actual Stan C++ for all density/mass functions (Distribution zoo is based on R distribution implementations).
8 |
9 | This currently supports the majority of Stan's univariate continuous distributions. Missing discrete distributions will be added shortly.
10 |
11 | ## Links
12 |
13 | ### Unbounded Continuous Distributions
14 |
15 | - [cauchy](https://rok-cesnovar.github.io/stan-distributions/cauchy)
16 |
17 | - [double_exponential](https://rok-cesnovar.github.io/stan-distributions/double_exponential)
18 |
19 | - [exp_mod_normal](https://rok-cesnovar.github.io/stan-distributions/exp_mod_normal)
20 |
21 | - [gumbel](https://rok-cesnovar.github.io/stan-distributions/gumbel)
22 |
23 | - [logistic](https://rok-cesnovar.github.io/stan-distributions/logistic)
24 |
25 | - [normal](https://rok-cesnovar.github.io/stan-distributions/normal)
26 |
27 | - [skew_double_exponential](https://rok-cesnovar.github.io/stan-distributions/skew_double_exponential)
28 |
29 | - [skew_normal](https://rok-cesnovar.github.io/stan-distributions/skew_normal)
30 |
31 | - [std_normal](https://rok-cesnovar.github.io/stan-distributions/std_normal)
32 |
33 | - [student_t](https://rok-cesnovar.github.io/stan-distributions/student_t)
34 |
35 | ### Positive Continuous Distributions
36 |
37 | - [chi_square](https://rok-cesnovar.github.io/stan-distributions/chi_square)
38 |
39 | - [exponential](https://rok-cesnovar.github.io/stan-distributions/exponential)
40 |
41 | - [frechet](https://rok-cesnovar.github.io/stan-distributions/frechet)
42 |
43 | - [gamma](https://rok-cesnovar.github.io/stan-distributions/gamma)
44 |
45 | - [inv_chi_square](https://rok-cesnovar.github.io/stan-distributions/inv_chi_square)
46 |
47 | - [inv_gamma](https://rok-cesnovar.github.io/stan-distributions/inv_gamma)
48 |
49 | - [lognormal](https://rok-cesnovar.github.io/stan-distributions/lognormal)
50 |
51 | - [rayleigh](https://rok-cesnovar.github.io/stan-distributions/rayleigh)
52 |
53 | - [scaled_inv_chi_square](https://rok-cesnovar.github.io/stan-distributions/scaled_inv_chi_square)
54 |
55 | - [weibull](https://rok-cesnovar.github.io/stan-distributions/weibull)
56 |
57 | ### Positive Lower-Bounded Distributions
58 |
59 | - [pareto](https://rok-cesnovar.github.io/stan-distributions/pareto)
60 |
61 | - [pareto_type_2](https://rok-cesnovar.github.io/stan-distributions/pareto_type_2)
62 |
63 | - [wiener](https://rok-cesnovar.github.io/stan-distributions/wiener)
64 |
65 | ### Continuous Distributions on [0, 1]
66 |
67 | - [beta](https://rok-cesnovar.github.io/stan-distributions/beta)
68 |
69 | - [beta_proportion](https://rok-cesnovar.github.io/stan-distributions/beta_proportion)
70 |
71 | ### Circular Distributions
72 |
73 | - [von_mises](https://rok-cesnovar.github.io/stan-distributions/von_mises)
74 |
75 | ### Bounded Continuous Distributions
76 |
77 | - [uniform](https://rok-cesnovar.github.io/stan-distributions/uniform)
78 | ### Unbounded Discrete Distributions
79 |
80 | - [neg_binomial](https://rok-cesnovar.github.io/stan-distributions/neg_binomial)
81 |
82 | - [neg_binomial_2](https://rok-cesnovar.github.io/stan-distributions/neg_binomial_2)
83 |
84 | - [neg_binomial_2_log](https://rok-cesnovar.github.io/stan-distributions/neg_binomial_2_log)
85 |
86 | - [poisson](https://rok-cesnovar.github.io/stan-distributions/poisson)
87 |
88 | - [poisson_log](https://rok-cesnovar.github.io/stan-distributions/poisson_log)
89 |
90 | ## Custom distributions
91 |
92 | - [beta_unbounded](https://rok-cesnovar.github.io/stan-distributions/beta_unbounded)
93 |
94 | Contributed by @noejn2.
95 |
96 | ## Running it locally
97 |
98 | 1. Clone the repository
99 |
100 | ```
101 | git clone https://github.com/rok-cesnovar/stan-distributions/
102 | ```
103 |
104 | 2. Start a simple Python server
105 |
106 | This is required in order to serve the .wasm files. The actual computation still happens in the browser.
107 |
108 | ```
109 | python3 -m http.server 8000
110 | ```
111 |
112 | 3. Open localhost:8000 in your favorite browser. Change the port number in step 2 if needed.
113 |
--------------------------------------------------------------------------------
/beta.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/beta_proportion.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/beta_unbounded.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/cauchy.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/chi_square.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/compile.sh:
--------------------------------------------------------------------------------
1 | REMOVE_TBB_HPPS="-DSTAN_MATH_PRIM_CORE_INIT_THREADPOOL_TBB_HPP -DSTAN_MATH_PRIM_FUNCTOR_REDUCE_SUM_HPP -DSTAN_MATH_PRIM_FUNCTOR_REDUCE_SUM_STATIC_HPP"
2 | CXXFLAGS="-std=c++1y -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes -O3 -DBOOST_DISABLE_ASSERTS"
3 |
4 | FILE=$1
5 |
6 | emcc $REMOVE_TBB_HPPS -o math-js-wasm/$FILE.js --bind math-cpp/$FILE.cpp $CXXFLAGS -I /home/rok/Desktop/cmdstan/stan/lib/stan_math/ -I /home/rok/Desktop/cmdstan/stan/lib/stan_math/lib/eigen_3.3.9 -I /home/rok/Desktop/cmdstan/stan/lib/stan_math/lib/boost_1.75.0 -I /home/rok/Desktop/cmdstan/stan/lib/stan_math/lib/sundials_6.1.1/include -I /home/rok/Desktop/cmdstan/stan/lib/stan_math/lib/sundials_6.1.1/src/sundials
--------------------------------------------------------------------------------
/double_exponential.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/exp_mod_normal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/exponential.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/frechet.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/gamma.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/gumbel.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/inv_chi_square.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/inv_gamma.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/logistic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/lognormal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/math-cpp/beta.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double beta_lpdf(double theta, double alpha, double beta) {
9 | return stan::math::beta_lpdf(theta, alpha, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("beta_lpdf", &beta_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/beta_proportion.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double beta_proportion_lpdf(double theta, double mu, double kappa) {
9 | return stan::math::beta_proportion_lpdf(theta, mu, kappa);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("beta_proportion_lpdf", &beta_proportion_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/beta_unbounded.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double beta_unbounded_lpdf(double y, double yupp, double mu, double phi) {
9 | double denominator = ((phi - 1) * stan::math::log(yupp));
10 | double logGamma = (stan::math::lgamma(phi) -
11 | (stan::math::lgamma((mu * phi)) +
12 | stan::math::lgamma(((1 - mu) * phi))));
13 | double numerator = ((((mu * phi) - 1) * stan::math::log(y)) +
14 | ((((1 - mu) * phi) - 1) * stan::math::log((yupp - y))));
15 | return (numerator - denominator) + logGamma;
16 | }
17 |
18 | EMSCRIPTEN_BINDINGS(my_module) {
19 | function("beta_unbounded_lpdf", &beta_unbounded_lpdf);
20 | }
--------------------------------------------------------------------------------
/math-cpp/cauchy.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double cauchy_lpdf(double y, double mu, double sigma) {
9 | return stan::math::cauchy_lpdf(y, mu, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("cauchy_lpdf", &cauchy_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/chi_square.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double chi_square_lpdf(double y, double nu) {
9 | return stan::math::chi_square_lpdf(y, nu);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("chi_square_lpdf", &chi_square_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/double_exponential.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double double_exponential_lpdf(double y, double mu, double sigma) {
9 | return stan::math::double_exponential_lpdf(y, mu, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("double_exponential_lpdf", &double_exponential_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/exp_mod_normal.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double exp_mod_normal_lpdf(double y, double mu, double sigma, double lambda) {
9 | return stan::math::exp_mod_normal_lpdf(y, mu, sigma, lambda);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("exp_mod_normal_lpdf", &exp_mod_normal_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/exponential.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double exponential_lpdf(double y, double beta) {
9 | return stan::math::exponential_lpdf(y, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("exponential_lpdf", &exponential_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/frechet.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double frechet_lpdf(double y, double alpha, double sigma) {
9 | return stan::math::frechet_lpdf(y, alpha, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("frechet_lpdf", &frechet_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/gamma.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double gamma_lpdf(double y, double alpha, double beta) {
9 | return stan::math::gamma_lpdf(y, alpha, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("gamma_lpdf", &gamma_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/gumbel.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double gumbel_lpdf(double y, double mu, double beta) {
9 | return stan::math::gumbel_lpdf(y, mu, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("gumbel_lpdf", &gumbel_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/inv_chi_square.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double inv_chi_square_lpdf(double y, double nu) {
9 | return stan::math::inv_chi_square_lpdf(y, nu);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("inv_chi_square_lpdf", &inv_chi_square_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/inv_gamma.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double inv_gamma_lpdf(double y, double alpha, double beta) {
9 | return stan::math::inv_gamma_lpdf(y, alpha, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("inv_gamma_lpdf", &inv_gamma_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/logistic.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double logistic_lpdf(double y, double mu, double sigma) {
9 | return stan::math::logistic_lpdf(y, mu, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("logistic_lpdf", &logistic_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/lognormal.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double lognormal_lpdf(double y, double mu, double sigma) {
9 | return stan::math::lognormal_lpdf(y, mu, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("lognormal_lpdf", &lognormal_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/neg_binomial.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double neg_binomial_lpmf(int n, double alpha, double beta) {
9 | return stan::math::neg_binomial_lpmf(n, alpha, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("neg_binomial_lpmf", &neg_binomial_lpmf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/neg_binomial_2.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double neg_binomial_2_lpmf(int n, double mu, double phi) {
9 | return stan::math::neg_binomial_2_lpmf(n, mu, phi);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("neg_binomial_2_lpmf", &neg_binomial_2_lpmf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/neg_binomial_2_log.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double neg_binomial_2_log_lpmf(int n, double eta, double phi) {
9 | return stan::math::neg_binomial_2_log_lpmf(n, eta, phi);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("neg_binomial_2_log_lpmf", &neg_binomial_2_log_lpmf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/normal.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double normal_lpdf(double y, double mu, double sigma) {
9 | return stan::math::normal_lpdf(y, mu, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("normal_lpdf", &normal_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/pareto.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double pareto_lpdf(double y, double y_min, double alpha) {
9 | return stan::math::pareto_lpdf(y, y_min, alpha);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("pareto_lpdf", &pareto_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/pareto_type_2.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double pareto_type_2_lpdf(double y, double mu, double lambda, double alpha) {
9 | return stan::math::pareto_type_2_lpdf(y, mu, lambda, alpha);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("pareto_type_2_lpdf", &pareto_type_2_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/poisson.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double poisson_lpmf(int n, double alpha) {
9 | return stan::math::poisson_lpmf(n, alpha);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("poisson_lpmf", &poisson_lpmf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/poisson_log.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double poisson_log_lpmf(int n, double lambda) {
9 | return stan::math::poisson_log_lpmf(n, lambda);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("poisson_log_lpmf", &poisson_log_lpmf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/rayleigh.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double rayleigh_lpdf(double y, double sigma) {
9 | return stan::math::rayleigh_lpdf(y, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("rayleigh_lpdf", &rayleigh_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/scaled_inv_chi_square.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double scaled_inv_chi_square_lpdf(double y, double nu, double sigma) {
9 | return stan::math::scaled_inv_chi_square_lpdf(y, nu, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("scaled_inv_chi_square_lpdf", &scaled_inv_chi_square_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/skew_double_exponential.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double skew_double_exponential_lpdf(double y, double mu, double sigma, double tau) {
9 | return stan::math::skew_double_exponential_lpdf(y, mu, sigma, tau);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("skew_double_exponential_lpdf", &skew_double_exponential_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/skew_normal.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double skew_normal_lpdf(double y, double xi, double omega, double alpha) {
9 | return stan::math::skew_normal_lpdf(y, xi, omega, alpha);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("skew_normal_lpdf", &skew_normal_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/std_normal.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double std_normal_lpdf(double y) {
9 | return stan::math::std_normal_lpdf(y);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("std_normal_lpdf", &std_normal_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/student_t.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double student_t_lpdf(double y, double nu, double mu, double sigma) {
9 | return stan::math::student_t_lpdf(y, nu, mu, sigma);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("student_t_lpdf", &student_t_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/uniform.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double uniform_lpdf(double y, double alpha, double beta) {
9 | return stan::math::uniform_lpdf(y, alpha, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("uniform_lpdf", &uniform_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/von_mises.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double von_mises_lpdf(double y, double mu, double kappa) {
9 | return stan::math::von_mises_lpdf(y, mu, kappa);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("von_mises_lpdf", &von_mises_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/weibull.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double weibull_lpdf(double y, double alpha, double beta) {
9 | return stan::math::weibull_lpdf(y, alpha, beta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("weibull_lpdf", &weibull_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-cpp/wiener.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | using namespace emscripten;
7 |
8 | double wiener_lpdf(double y, double alpha, double tau, double beta, double delta) {
9 | return stan::math::wiener_lpdf(y, alpha, tau, beta, delta);
10 | }
11 |
12 | EMSCRIPTEN_BINDINGS(my_module) {
13 | function("wiener_lpdf", &wiener_lpdf);
14 | }
--------------------------------------------------------------------------------
/math-js-wasm/beta.js:
--------------------------------------------------------------------------------
1 | var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;var toLog=e;err("exiting due to exception: "+toLog)}var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);return nodeFS["readFileSync"](filename,binary?null:"utf8")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};readAsync=function readAsync(filename,onload,onerror){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);nodeFS["readFile"](filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=function(status,toThrow){if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=function(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!=="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heap,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heap[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heap.subarray&&UTF8Decoder){return UTF8Decoder.decode(heap.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function UTF16ToString(ptr,maxBytesToRead){var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder){return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr))}else{var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}}function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}function lengthBytesUTF16(str){return str.length*2}function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeKeepaliveCounter=0;function keepRuntimeAlive(){return noExitRuntime||runtimeKeepaliveCounter>0}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};function abort(what){{if(Module["onAbort"]){Module["onAbort"](what)}}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="beta.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["s"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["u"];addOnInit(Module["asm"]["t"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){getWasmTableEntry(func)()}else{getWasmTableEntry(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function ___cxa_allocate_exception(size){return _malloc(size+16)+16}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-16;this.set_type=function(type){HEAP32[this.ptr+4>>2]=type};this.get_type=function(){return HEAP32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAP32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAP32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}else{return name}}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}};return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i>shift])},destructorFunction:null})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i>2])}function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv},"toWireType":function(destructors,value){return Emval.toHandle(value)},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:null})}function _embind_repr(v){if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 3:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){return value},"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?", ":"")+argsListWired}invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i>2)+i])}return array}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function dynCallLegacy(sig,ptr,args){var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)}function dynCall(sig,ptr,args){if(sig.includes("j")){return dynCallLegacy(sig,ptr,args)}return getWasmTableEntry(ptr).apply(null,args)}function getDynCaller(sig,ptr){var argCache=[];return function(){argCache.length=arguments.length;for(var i=0;i>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=function(value){return value};if(minRange===0){var bitshift=32-8*size;fromWireType=function(value){return value<>>bitshift}}var isUnsignedType=name.includes("unsigned");registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}if(valuemaxRange){throw new TypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+", "+maxRange+"]!")}return isUnsignedType?value>>>0:value|0},"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var str;if(stdStringIsUTF8){var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr+4,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}}else{for(var i=0;i>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},"toWireType":function(destructors,value){if(!(typeof value==="string")){throwBindingError("Cannot pass non-string to C++ string type "+name)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,"argPackAdvance":0,"fromWireType":function(){return undefined},"toWireType":function(destructors,o){return undefined}})}function _abort(){abort("")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator==="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}else{return"PM"}},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"},"%V":function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}embind_init_charCodes();BindingError=Module["BindingError"]=extendError(Error,"BindingError");InternalError=Module["InternalError"]=extendError(Error,"InternalError");init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var asmLibraryArg={"c":___cxa_allocate_exception,"a":___cxa_throw,"l":__embind_register_bigint,"j":__embind_register_bool,"i":__embind_register_emval,"f":__embind_register_float,"r":__embind_register_function,"d":__embind_register_integer,"b":__embind_register_memory_view,"g":__embind_register_std_string,"e":__embind_register_std_wstring,"k":__embind_register_void,"h":_abort,"m":_emscripten_memcpy_big,"n":_emscripten_resize_heap,"p":_environ_get,"q":_environ_sizes_get,"o":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["t"]).apply(null,arguments)};var ___getTypeName=Module["___getTypeName"]=function(){return(___getTypeName=Module["___getTypeName"]=Module["asm"]["v"]).apply(null,arguments)};var ___embind_register_native_and_builtin_types=Module["___embind_register_native_and_builtin_types"]=function(){return(___embind_register_native_and_builtin_types=Module["___embind_register_native_and_builtin_types"]=Module["asm"]["w"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["x"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["y"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["z"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["A"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["B"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["C"]).apply(null,arguments)};var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();
2 |
--------------------------------------------------------------------------------
/math-js-wasm/beta.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/beta.wasm
--------------------------------------------------------------------------------
/math-js-wasm/beta_proportion.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/beta_proportion.wasm
--------------------------------------------------------------------------------
/math-js-wasm/beta_unbounded.js:
--------------------------------------------------------------------------------
1 | var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}requireNodeFS=(()=>{if(!nodePath){fs=require("fs");nodePath=require("path")}});read_=function shell_read(filename,binary){requireNodeFS();filename=nodePath["normalize"](filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=(filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret});readAsync=((filename,onload,onerror)=>{requireNodeFS();filename=nodePath["normalize"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})});if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=((status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)});Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=(url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText});if(ENVIRONMENT_IS_WORKER){readBinary=(url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)})}readAsync=((url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=(()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()});xhr.onerror=onerror;xhr.send(null)})}setWindowTitle=(title=>document.title=title)}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;function UTF16ToString(ptr,maxBytesToRead){var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder){return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr))}else{var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}}function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}function lengthBytesUTF16(str){return str.length*2}function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};function abort(what){{if(Module["onAbort"]){Module["onAbort"](what)}}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="beta_unbounded.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["s"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["u"];addOnInit(Module["asm"]["t"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func=="number"){if(callback.arg===undefined){getWasmTableEntry(func)()}else{getWasmTableEntry(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function ___cxa_allocate_exception(size){return _malloc(size+16)+16}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-16;this.set_type=function(type){HEAP32[this.ptr+4>>2]=type};this.get_type=function(){return HEAP32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAP32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAP32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}return name}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}};return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}}function registerType(rawType,registeredInstance,options={}){if(!("argPackAdvance"in registeredInstance)){throw new TypeError("registerType registeredInstance requires argPackAdvance")}var name=registeredInstance.name;if(!rawType){throwBindingError('type "'+name+'" must have a positive integer typeid pointer')}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError("Cannot register type '"+name+"' twice")}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(wt){return!!wt},"toWireType":function(destructors,o){return o?trueValue:falseValue},"argPackAdvance":8,"readValueFromPointer":function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError("Unknown boolean type size: "+name)}return this["fromWireType"](heap[pointer>>shift])},destructorFunction:null})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return emval_handle_array[handle].value},toHandle:value=>{switch(value){case undefined:return 1;case null:return 2;case true:return 3;case false:return 4;default:{var handle=emval_free_list.length?emval_free_list.pop():emval_handle_array.length;emval_handle_array[handle]={refcount:1,value:value};return handle}}}};function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv},"toWireType":function(destructors,value){return Emval.toHandle(value)},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:null})}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 3:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){return value},"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?", ":"")+argsListWired}invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i>2)+i])}return array}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function dynCallLegacy(sig,ptr,args){var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)}function dynCall(sig,ptr,args){if(sig.includes("j")){return dynCallLegacy(sig,ptr,args)}return getWasmTableEntry(ptr).apply(null,args)}function getDynCaller(sig,ptr){var argCache=[];return function(){argCache.length=0;Object.assign(argCache,arguments);return dynCall(sig,ptr,argCache)}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes("j")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError("unknown function pointer with signature "+signature+": "+rawFunction)}return fp}var UnboundTypeError=undefined;function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+": "+unboundTypes.map(getTypeName).join([", "]))}function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call "+name+" due to unbound types",argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn),argCount-1);return[]})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=(value=>value<>>bitshift)}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":toWireType,"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var str;if(stdStringIsUTF8){var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;ilengthBytesUTF8(value))}else{getLength=(()=>value.length)}var length=getLength();var ptr=_malloc(4+length+1);HEAPU32[ptr>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr+4,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}}else{for(var i=0;iHEAPU16);shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=(()=>HEAPU32);shift=2}registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},"toWireType":function(destructors,value){if(!(typeof value=="string")){throwBindingError("Cannot pass non-string to C++ string type "+name)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,"argPackAdvance":0,"fromWireType":function(){return undefined},"toWireType":function(destructors,o){return undefined}})}function _abort(){abort("")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}var SYSCALLS={buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}else{return"PM"}},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}embind_init_charCodes();BindingError=Module["BindingError"]=extendError(Error,"BindingError");InternalError=Module["InternalError"]=extendError(Error,"InternalError");init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var asmLibraryArg={"d":___cxa_allocate_exception,"c":___cxa_throw,"l":__embind_register_bigint,"j":__embind_register_bool,"i":__embind_register_emval,"g":__embind_register_float,"r":__embind_register_function,"b":__embind_register_integer,"a":__embind_register_memory_view,"f":__embind_register_std_string,"e":__embind_register_std_wstring,"k":__embind_register_void,"h":_abort,"q":_emscripten_memcpy_big,"p":_emscripten_resize_heap,"n":_environ_get,"o":_environ_sizes_get,"m":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["t"]).apply(null,arguments)};var ___getTypeName=Module["___getTypeName"]=function(){return(___getTypeName=Module["___getTypeName"]=Module["asm"]["v"]).apply(null,arguments)};var ___embind_register_native_and_builtin_types=Module["___embind_register_native_and_builtin_types"]=function(){return(___embind_register_native_and_builtin_types=Module["___embind_register_native_and_builtin_types"]=Module["asm"]["w"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["x"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["y"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["z"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["A"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["B"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["C"]).apply(null,arguments)};var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();
2 |
--------------------------------------------------------------------------------
/math-js-wasm/beta_unbounded.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/beta_unbounded.wasm
--------------------------------------------------------------------------------
/math-js-wasm/cauchy.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/cauchy.wasm
--------------------------------------------------------------------------------
/math-js-wasm/chi_square.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/chi_square.wasm
--------------------------------------------------------------------------------
/math-js-wasm/double_exponential.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/double_exponential.wasm
--------------------------------------------------------------------------------
/math-js-wasm/exp_mod_normal.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/exp_mod_normal.wasm
--------------------------------------------------------------------------------
/math-js-wasm/exponential.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/exponential.wasm
--------------------------------------------------------------------------------
/math-js-wasm/frechet.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/frechet.wasm
--------------------------------------------------------------------------------
/math-js-wasm/gamma.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/gamma.wasm
--------------------------------------------------------------------------------
/math-js-wasm/gumbel.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/gumbel.wasm
--------------------------------------------------------------------------------
/math-js-wasm/inv_chi_square.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/inv_chi_square.wasm
--------------------------------------------------------------------------------
/math-js-wasm/inv_gamma.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/inv_gamma.wasm
--------------------------------------------------------------------------------
/math-js-wasm/logistic.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/logistic.wasm
--------------------------------------------------------------------------------
/math-js-wasm/lognormal.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/lognormal.wasm
--------------------------------------------------------------------------------
/math-js-wasm/neg_binomial.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/neg_binomial.wasm
--------------------------------------------------------------------------------
/math-js-wasm/neg_binomial_2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/neg_binomial_2.wasm
--------------------------------------------------------------------------------
/math-js-wasm/neg_binomial_2_log.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/neg_binomial_2_log.wasm
--------------------------------------------------------------------------------
/math-js-wasm/normal_lpdf.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/normal_lpdf.wasm
--------------------------------------------------------------------------------
/math-js-wasm/pareto.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/pareto.wasm
--------------------------------------------------------------------------------
/math-js-wasm/pareto_type_2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/pareto_type_2.wasm
--------------------------------------------------------------------------------
/math-js-wasm/poisson.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/poisson.wasm
--------------------------------------------------------------------------------
/math-js-wasm/poisson_log.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/poisson_log.wasm
--------------------------------------------------------------------------------
/math-js-wasm/rayleigh.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/rayleigh.wasm
--------------------------------------------------------------------------------
/math-js-wasm/scaled_inv_chi_square.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/scaled_inv_chi_square.wasm
--------------------------------------------------------------------------------
/math-js-wasm/skew_double_exponential.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/skew_double_exponential.wasm
--------------------------------------------------------------------------------
/math-js-wasm/skew_normal.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/skew_normal.wasm
--------------------------------------------------------------------------------
/math-js-wasm/std_normal.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/std_normal.wasm
--------------------------------------------------------------------------------
/math-js-wasm/student_t.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/student_t.wasm
--------------------------------------------------------------------------------
/math-js-wasm/uniform.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/uniform.wasm
--------------------------------------------------------------------------------
/math-js-wasm/von_mises.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/von_mises.wasm
--------------------------------------------------------------------------------
/math-js-wasm/weibull.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/weibull.wasm
--------------------------------------------------------------------------------
/math-js-wasm/wiener.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rok-cesnovar/stan-distributions/3ff6083da0a5fdf306a2ff93e9b1119023d309e8/math-js-wasm/wiener.wasm
--------------------------------------------------------------------------------
/neg_binomial.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/neg_binomial_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/neg_binomial_2_log.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/normal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/pareto.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/pareto_type_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/poisson.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/poisson_log.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/rayleigh.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/scaled_inv_chi_square.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/skew_double_exponential.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/skew_normal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/stan-distribution-zoo.js:
--------------------------------------------------------------------------------
1 | var height;
2 | var width;
3 | function add_figure(x_axis_text) {
4 |
5 | update_data()
6 |
7 | if (continuous) {
8 | const margin = { top: 30, right: 50, bottom: 30, left: 50 };
9 | width = $("#figure").width() - margin.left - margin.right;
10 | height = 500 - margin.top - margin.bottom;
11 |
12 | svg = d3.select("#figure")
13 | .append("svg")
14 | .attr("width", width + margin.left + margin.right)
15 | .attr("height", height + margin.top + margin.bottom + 20)
16 | .append("g")
17 | .attr("transform", `translate(${margin.left},${margin.top})`);
18 |
19 | x = d3.scaleLinear().range([0, width]);
20 | xAxis = d3.axisBottom().scale(x);
21 | svg.append("g")
22 | .attr("transform", `translate(0, ${height})`)
23 | .attr("class", "myXaxis")
24 |
25 | y = d3.scaleLinear().range([height, 0]);
26 | yAxis = d3.axisLeft().scale(y);
27 | svg.append("g")
28 | .attr("class", "myYaxis")
29 | } else {
30 | const margin = { top: 30, right: 50, bottom: 30, left: 50 };
31 | width = $("#figure").width() - margin.left - margin.right;
32 | height = 500 - margin.top - margin.bottom;
33 | // append the svg object to the body of the page
34 | svg = d3.select("#figure")
35 | .append("svg")
36 | .attr("width", width + margin.left + margin.right + 20)
37 | .attr("height", height + margin.top + margin.bottom + 20)
38 | .append("g")
39 | .attr("transform", `translate(${margin.left},${margin.top})`);
40 |
41 | // Initialize the X axis
42 | x = d3.scaleBand()
43 | .range([0, width])
44 | .padding(0.2);
45 | xAxis = svg.append("g")
46 | .attr("transform", `translate(0,${height})`)
47 |
48 | // Initialize the Y axis
49 | y = d3.scaleLinear()
50 | .range([height, 0]);
51 | yAxis = svg.append("g")
52 | .attr("class", "myYaxis")
53 |
54 | }
55 |
56 | svg.append("text")
57 | .attr("class", "x label")
58 | .attr("text-anchor", "end")
59 | .attr("x", width/2)
60 | .attr("y", height+30)
61 | .text(x_axis_text);
62 |
63 | update()
64 | }
65 |
66 | function setBubble(range, bubble) {
67 | const val = range.val();
68 | const min = range.attr("min");
69 | const max = range.attr("max");
70 | const newVal = Number(((val - min) * 100) / (max - min));
71 | bubble
72 | .html(val)
73 | .css("left", `calc(${newVal}% + (${8 - newVal * 0.15}px))`);
74 | }
75 |
76 | function setup_page(settings) {
77 | $(document).ready(function () {
78 | $("head").append($("" + settings.function_name + ""));
79 | var body = $("body");
80 | var function_name = $('' + settings.function_name + '
');
81 | body.append(function_name);
82 |
83 | for (i = 0; i < settings.sliders.length; i++) {
84 | var label = $('');
85 | var inp = $('');
89 | var out = $('');
90 | inp.on("input", function () {
91 |
92 | setBubble($(this), $(this).parent().children('.bubble'))
93 | });
94 | inp.on("change", function () {
95 | $(".range").each(function () {
96 | params[$(this).attr("name")] = $(this).val();
97 | });
98 | update()
99 | })
100 | setBubble(inp, out);
101 | var slider = $('');
102 | body.append(slider.append(label).append(inp).append(out));
103 | }
104 | if (settings.exponentiate) {
105 | var exp_check = $(
106 | '' +
107 | '
');
108 | exp_check.on("change", function () {
109 | update()
110 | })
111 | body.append(exp_check);
112 | }
113 | var add_text = $(settings.additional_text);
114 | body.append(add_text)
115 | add_figure(settings.x_axis_text)
116 | });
117 |
118 |
119 | }
120 |
121 | function update() {
122 | update_data()
123 |
124 | if (continuous) {
125 | if (typeof x_axis_start !== 'undefined') {
126 | x_domain_min = x_axis_start
127 | } else {
128 | x_domain_min = d3.min(data, function (d) { return d.ser1 })
129 | }
130 | if (typeof x_axis_stop !== 'undefined') {
131 | x_domain_max = x_axis_stop
132 | } else {
133 | x_domain_max = d3.max(data, function (d) { return d.ser1 })
134 | }
135 | x.domain([x_domain_min, x_domain_max]);
136 | svg.selectAll(".myXaxis").transition()
137 | .duration(2000)
138 | .call(xAxis);
139 |
140 | y.domain([d3.min(data, function (d) { return d.ser2 }), d3.max(data, function (d) { return d.ser2 })]);
141 | svg.selectAll(".myYaxis")
142 | .transition()
143 | .duration(2000)
144 | .call(yAxis);
145 |
146 | const u = svg.selectAll(".lineTest")
147 | .data([data], function (d) { return d.ser1 });
148 |
149 | u
150 | .join("path")
151 | .attr("class", "lineTest")
152 | .transition()
153 | .duration(2000)
154 | .attr("d", d3.line()
155 | .x(function (d) { return x(d.ser1); })
156 | .y(function (d) { return y(d.ser2); }))
157 | .attr("fill", "none")
158 | .attr("stroke", "#b2001d")
159 | .attr("stroke-width", 3.5)
160 | } else {
161 | x.domain(data.map(d => d.ser1))
162 | xAxis.call(d3.axisBottom(x))
163 |
164 | y.domain([d3.min(data, d => d.ser2), d3.max(data, d => d.ser2)]);
165 | yAxis.transition().duration(1000).call(d3.axisLeft(y));
166 |
167 | var u = svg.selectAll("rect")
168 | .data(data)
169 |
170 | u
171 | .join("rect")
172 | .transition()
173 | .duration(1000)
174 | .attr("x", d => x(d.ser1))
175 | .attr("y", d => y(d.ser2))
176 | .attr("width", x.bandwidth())
177 | .attr("height", d => height - y(d.ser2))
178 | .attr("fill", "#b2001d")
179 | }
180 |
181 | }
182 |
183 |
--------------------------------------------------------------------------------
/std_normal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/student_t.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/style.css:
--------------------------------------------------------------------------------
1 | .sliders {
2 | width: 300px;
3 | }
4 | .range-wrap {
5 | position: relative;
6 | margin: 0 auto 1rem;
7 | width: 50%;
8 | }
9 | .range {
10 | width: 100%;
11 | }
12 | .bubble {
13 | background: #b2001d;
14 | color: white;
15 | padding: 4px 12px;
16 | position: absolute;
17 | border-radius: 4px;
18 | left: 50%;
19 | transform: translateX(-50%);
20 | top: 76%;
21 | }
22 | .bubble::after {
23 | content: "";
24 | position: absolute;
25 | width: 2px;
26 | height: 2px;
27 | background: #b2001d;
28 | top: -1px;
29 | left: 50%;
30 | }
31 | input[type=range] {
32 | height: 25px;
33 | -webkit-appearance: none;
34 | margin: 10px 0;
35 | width: 100%;
36 | }
37 | input[type=range]:focus {
38 | outline: none;
39 | }
40 | input[type=range]::-webkit-slider-runnable-track {
41 | width: 100%;
42 | height: 5px;
43 | cursor: pointer;
44 | animate: 0.2s;
45 | box-shadow: 0px 0px 0px #000000;
46 | background: #b2001d;
47 | border-radius: 1px;
48 | border: 0px solid #000000;
49 | }
50 | input[type=range]::-webkit-slider-thumb {
51 | box-shadow: 0px 0px 0px #000000;
52 | border: 1px solid #b2001d;
53 | height: 18px;
54 | width: 18px;
55 | border-radius: 25px;
56 | background: #b2001d;
57 | cursor: pointer;
58 | -webkit-appearance: none;
59 | margin-top: -7px;
60 | }
61 | input[type=range]:focus::-webkit-slider-runnable-track {
62 | background: #b2001d;
63 | }
64 | input[type=range]::-moz-range-track {
65 | width: 100%;
66 | height: 5px;
67 | cursor: pointer;
68 | animate: 0.2s;
69 | box-shadow: 0px 0px 0px #000000;
70 | background: #b2001d;
71 | border-radius: 1px;
72 | border: 0px solid #000000;
73 | }
74 | input[type=range]::-moz-range-thumb {
75 | box-shadow: 0px 0px 0px #000000;
76 | border: 1px solid #b2001d;
77 | height: 18px;
78 | width: 18px;
79 | border-radius: 25px;
80 | background: #b2001d;
81 | cursor: pointer;
82 | }
83 | input[type=range]::-ms-track {
84 | width: 100%;
85 | height: 5px;
86 | cursor: pointer;
87 | animate: 0.2s;
88 | background: transparent;
89 | border-color: transparent;
90 | color: transparent;
91 | }
92 | input[type=range]::-ms-fill-lower {
93 | background: #b2001d;
94 | border: 0px solid #000000;
95 | border-radius: 2px;
96 | box-shadow: 0px 0px 0px #000000;
97 | }
98 | input[type=range]::-ms-fill-upper {
99 | background: #b2001d;
100 | border: 0px solid #000000;
101 | border-radius: 2px;
102 | box-shadow: 0px 0px 0px #000000;
103 | }
104 | input[type=range]::-ms-thumb {
105 | margin-top: 1px;
106 | box-shadow: 0px 0px 0px #000000;
107 | border: 1px solid #b2001d;
108 | height: 18px;
109 | width: 18px;
110 | border-radius: 25px;
111 | background: #b2001d;
112 | cursor: pointer;
113 | }
114 | input[type=range]:focus::-ms-fill-lower {
115 | background: #b2001d;
116 | }
117 | input[type=range]:focus::-ms-fill-upper {
118 | background: #b2001d;
119 | }
120 | .container {
121 | display: block;
122 | position: relative;
123 | padding-left: 35px;
124 | margin-bottom: 12px;
125 | cursor: pointer;
126 | font-size: 22px;
127 | -webkit-user-select: none;
128 | -moz-user-select: none;
129 | -ms-user-select: none;
130 | user-select: none;
131 | }
132 |
133 | /* Hide the browser's default checkbox */
134 | .container input {
135 | position: absolute;
136 | opacity: 0;
137 | cursor: pointer;
138 | height: 0;
139 | width: 0;
140 | }
141 |
142 | /* Create a custom checkbox */
143 | .checkmark {
144 | position: absolute;
145 | top: 0;
146 | left: 0;
147 | height: 25px;
148 | width: 25px;
149 | background-color: #eee;
150 | }
151 |
152 | /* On mouse-over, add a grey background color */
153 | .container:hover input ~ .checkmark {
154 | background-color: #ccc;
155 | }
156 |
157 | /* When the checkbox is checked, add a blue background */
158 | .container input:checked ~ .checkmark {
159 | background-color: #b2001d;
160 | }
161 |
162 | /* Create the checkmark/indicator (hidden when not checked) */
163 | .checkmark:after {
164 | content: "";
165 | position: absolute;
166 | display: none;
167 | }
168 |
169 | /* Show the checkmark when checked */
170 | .container input:checked ~ .checkmark:after {
171 | display: block;
172 | }
173 |
174 | /* Style the checkmark/indicator */
175 | .container .checkmark:after {
176 | left: 9px;
177 | top: 5px;
178 | width: 5px;
179 | height: 10px;
180 | border: solid white;
181 | border-width: 0 3px 3px 0;
182 | -webkit-transform: rotate(45deg);
183 | -ms-transform: rotate(45deg);
184 | transform: rotate(45deg);
185 | }
186 |
187 | .distribution-name {
188 | width: 50%;
189 | margin: auto;
190 | }
191 |
192 | #figure {
193 | width: 50%;
194 | margin: auto;
195 | }
--------------------------------------------------------------------------------
/uniform.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/von_mises.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/weibull.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/wiener.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------