utils.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #ifndef ARMA_R
12 #include <armadillo>
13 #endif
14 #if defined(ARMA_R)
15 #include <RcppArmadillo.h>
16 #endif
17 #include <cmath>
18 #include <complex>
19 #include <cfloat> // precision of double (DBL_MIN)
20 #include <functional> // std::bind for using non-static member function as argument to free function
21 
22 
23 namespace target {
24  using cx_dbl = std::complex<double>;
25  using cx_func = std::function<arma::cx_mat(arma::cx_vec theta)>;
26 
27  arma::mat deriv(cx_func f,
28  arma::vec theta);
29 
30  arma::umat clusterid(const arma::uvec &id);
31 
32  arma::mat groupsum(const arma::mat &x,
33  const arma::uvec &cluster,
34  bool reduce = true);
35 
36  arma::mat interpolate(const arma::mat &input, double tau, bool locf);
37 
38  void fastpattern(const arma::umat &y,
39  arma::umat &pattern,
40  arma::uvec &group,
41  unsigned categories = 2);
42 
43  arma::umat fastapprox(arma::vec time, // sorted times
44  const arma::vec &newtime,
45  bool equal = false,
46  // type: (0: nearedst, 1: right, 2: left)
47  unsigned type = 0);
48 
49  double SupTest(const arma::vec &D);
50  double L2Test(const arma::vec &D,
51  const arma::vec &t);
52  double CramerVonMises(const arma::vec &x,
53  const arma::vec &G);
54 
55  extern arma::mat const EmptyMat;
56  extern arma::vec const EmptyVec;
57 
58  extern const char* COL_RESET;
59  extern const char* COL_DEF;
60  extern const char* BLACK;
61  extern const char* RED;
62  extern const char* MAGENTA;
63  extern const char* YELLOW;
64  extern const char* GREEN;
65  extern const char* BLUE;
66  extern const char* CYAN;
67  extern const char* WHITE;
68  extern const char* GRAY;
69  extern const char* LRED;
70  extern const char* LGREEN;
71  extern const char* LYELLOW;
72  extern const char* LBLUE;
73  extern const char* LMAGENTA;
74  extern const char* LCYAN;
75  extern const char* LWHITE;
76 
77 } // namespace target