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  arma::mat groupsum(const arma::mat &x,
32  const arma::uvec &cluster,
33  bool reduce = true);
34  void fastpattern(const arma::umat &y,
35  arma::umat &pattern,
36  arma::uvec &group,
37  unsigned categories = 2);
38  arma::umat fastapprox(arma::vec &time, // sorted times
39  const arma::vec &newtime,
40  bool equal = false,
41  // type: (0: nearedst, 1: right, 2: left)
42  unsigned type = 0);
43 
44  double SupTest(const arma::vec &D);
45  double L2Test(const arma::vec &D,
46  const arma::vec &t);
47  double CramerVonMises(const arma::vec &x,
48  const arma::vec &G);
49 
50  extern arma::mat const EmptyMat;
51  extern arma::vec const EmptyVec;
52 
53  extern const char* COL_RESET;
54  extern const char* COL_DEF;
55  extern const char* BLACK;
56  extern const char* RED;
57  extern const char* MAGENTA;
58  extern const char* YELLOW;
59  extern const char* GREEN;
60  extern const char* BLUE;
61  extern const char* CYAN;
62  extern const char* WHITE;
63  extern const char* GRAY;
64  extern const char* LRED;
65  extern const char* LGREEN;
66  extern const char* LYELLOW;
67  extern const char* LBLUE;
68  extern const char* LMAGENTA;
69  extern const char* LCYAN;
70  extern const char* LWHITE;
71 
72 } // namespace target