forked from google/longbet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.h
81 lines (62 loc) · 2.05 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* BART: Bayesian Additive Regression Trees
* Copyright (C) 2017 Robert McCulloch and Rodney Sparapani
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, a copy is available at
* https://www.R-project.org/Licenses/GPL-2
*/
#ifndef GUARD_common_h
#define GUARD_common_h
#ifdef MATHLIB_STANDALONE
#define NoRcpp
#else
#define RNG_Rcpp
#endif
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <random>
#include <vector>
#include <cassert>
//#include <RcppParallel.h>
#include <map>
#include <climits>
//using namespace RcppParallel;
using std::endl;
#ifdef BEGIN_RCPP // May need to change this
#include <RcppArmadillo.h>
// #include <Rcpp.h>
#define COUT Rcpp::Rcout
#else
#define COUT std::cout
#endif
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::plugins(cpp11)]]
// #include <Rcpp.h>
// #define printf Rprintf
// #define err Rcpp::Rerr
// #define assert Rcpp::Rassert
// log(2*pi)
#define LTPI 1.83787706640934536
// #include "rn.h" // Removed
std::ostream &operator<<(std::ostream &out, const std::vector<double> &v);
std::ostream &operator<<(std::ostream &out, const std::vector<size_t> &v);
std::ostream &operator<<(std::ostream &out, const std::vector<std::vector<double>> &v);
std::ostream &operator<<(std::ostream &out, const std::vector<std::vector<size_t>> &v);
typedef std::vector<double> vec_d; //double vector
typedef std::vector<size_t> vec_sizet; // unsigned int vector
template <typename T>
using matrix = std::vector<std::vector<T>>;
#endif