This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define OPENCL_PLATFORM_ID 0 | |
#define OPENCL_DEVICE_ID 0 | |
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS | |
//#define USE_TIMING_OUTPUTS | |
//#include <CL/cl.hpp> | |
#include <Eigen/Dense> | |
#include <stan/math.hpp> | |
#include <vector> | |
#include <iostream> |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Phi(int) | |
Phi(real) | |
Phi(vector) | |
Phi(row vector) | |
Phi(matrix) | |
Phi(int[]) | |
Phi(real[]) | |
Phi(vector[]) | |
Phi(row vector[]) | |
Phi(matrix[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <functional> | |
#include <Eigen/Dense> | |
#include <algorithm> | |
#include <iostream> | |
// CONFIGURABLE SIZES | |
typedef unsigned int index_t; // determines max expression size | |
typedef double real_t; // basic scalar type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdf = function(x, pdf) { | |
sapply(x, function(x) { | |
integrate(pdf, -Inf, x)$value | |
}) | |
} | |
u = cdf(rnorm(1e5), dnorm) | |
hist(u, breaks=100) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/stan/math/prim/mat/fun/log_mix.hpp b/stan/math/prim/mat/fun/log_mix.hpp | |
index 3c7063ba3f..de82cc89b7 100644 | |
--- a/stan/math/prim/mat/fun/log_mix.hpp | |
+++ b/stan/math/prim/mat/fun/log_mix.hpp | |
@@ -125,20 +125,20 @@ typename return_type<T_theta, T_lam>::type log_mix(const T_theta& theta, | |
* @param lambda array containing vectors of log densities. | |
* @return log mixture of densities in specified proportion | |
*/ | |
-template <typename T_theta, typename T_lam> | |
-typename return_type<T_theta, std::vector<Eigen::Matrix<T_lam, -1, 1> > >::type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dans.rng = function(N_samp, n_eff, planck_length) { | |
pnorm(rnorm(N_samp, sd=1 + runif(N_samp, -1/sqrt(n_eff), 1/sqrt(n_eff)))) | |
} | |
discrete.dan = function(N_samp, n_eff, pl) { | |
round(pnorm(rnorm(N_samp, sd=1 + runif(N_samp, -1/sqrt(n_eff), 1/sqrt(n_eff)))) * pl) / pl | |
} | |
linear_neff_plots = function(xlab, gen_data, n_samp, n_eff, planck_length) { | |
data = gen_data(n_samp, n_eff, planck_length) | |
bins <- n_eff * c(0.5, 1, 2, 3, 10, 50) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data { | |
int<lower=0> N; // num individuals | |
int<lower=1> K; // num ind predictors | |
int<lower=1> J; // num groups | |
int<lower=1> L; // num group predictors | |
int<lower=1,upper=J> jj[N]; // group for individual | |
} | |
generated quantities { | |
matrix[K, J] z; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data { | |
int<lower=0> N; // num individuals | |
int<lower=1> K; // num ind predictors | |
int<lower=1> J; // num groups | |
int<lower=1> L; // num group predictors | |
int<lower=1,upper=J> jj[N]; // group for individual | |
matrix[N, K] x; // individual predictors | |
matrix[J, L] u; // group predictors | |
vector[N] y; // outcomes | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data { | |
int<lower=0> N; // num individuals | |
int<lower=1> K; // num ind predictors | |
int<lower=1> J; // num groups | |
int<lower=1> L; // num group predictors | |
int<lower=1,upper=J> jj[N]; // group for individual | |
matrix[N, K] x; // individual predictors | |
row_vector[L] u[J]; // group predictors | |
vector[N] y; // outcomes | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MicroKanren where | |
import Data.List (transpose) | |
import Data.Maybe | |
import Control.Monad | |
data Term = Var Int | Atom String | |
deriving (Eq, Show) | |
------------------------------------------ |