9 struct isDouble<double>{
18 #define TMB_PRINT(x)std::cout << #x << ": " << x << "\n"; std::cout.flush(); 23 #define TMB_EXTERN extern 25 #define CSKIP(...) __VA_ARGS__ 28 #ifdef TMB_PRECOMPILE_ATOMICS 29 #define IF_TMB_PRECOMPILE_ATOMICS(...) __VA_ARGS__ 31 #define IF_TMB_PRECOMPILE_ATOMICS(...) 33 #ifdef HAVE_PRECOMPILED_ATOMICS 34 #define CSKIP_ATOMIC(...) ; 36 #define CSKIP_ATOMIC(...) __VA_ARGS__ 45 #include <R_ext/Print.h> 46 #include "Rstream.hpp" 50 #define TMB_ABORT abort() 57 void eigen_REprintf(
const char* x);
58 #define eigen_assert(x) if (!(x)) { eigen_REprintf("TMB has received an error from Eigen. "); \ 59 eigen_REprintf("The following condition was not met:\n"); \ 61 eigen_REprintf("\nPlease check your matrix-vector bounds etc., "); \ 62 eigen_REprintf("or run your program through a debugger.\n"); \ 64 #define TMBAD_ASSERT2(x,msg) \ 66 Rcerr << "TMBad assertion failed.\n"; \ 67 Rcerr << "The following condition was not met: " << #x << "\n"; \ 68 Rcerr << "Possible reason: " msg << "\n"; \ 69 Rcerr << "For more info run your program through a debugger.\n"; \ 72 #define TMBAD_ASSERT(x) TMBAD_ASSERT2(x,"Unknown") 76 #define TMBAD_ASSERT2(x,msg) (void) (x); 77 #define TMBAD_ASSERT(x) (void) (x); 82 #ifdef TMB_EIGEN_DISABLE_WARNINGS 83 #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 84 #define EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 1 86 #include "EigenWarnings/DisableStupidWarnings" 89 #ifndef EIGEN_DONT_PARALLELIZE 90 #define EIGEN_DONT_PARALLELIZE 92 #include <Eigen/Dense> 95 #ifndef TMB_SPARSE_STORAGE_INDEX 96 #include <Eigen/Sparse> 99 #define SparseMatrix SparseMatrix_rename 100 #include <Eigen/Sparse> 103 template<
class T,
int Flags = 0,
class StorageIndex = TMB_SPARSE_STORAGE_INDEX>
104 using SparseMatrix = SparseMatrix_rename<T, Flags, StorageIndex>;
112 #ifndef CPPAD_FRAMEWORK 113 #ifndef TMBAD_FRAMEWORK 114 #define CPPAD_FRAMEWORK 121 #include "cppad/cppad.hpp" 122 #ifdef TMBAD_FRAMEWORK 123 #include "TMBad/TMBad.hpp" 124 #include "TMBad/tmbad_allow_comparison.hpp" 125 #include "TMBad/eigen_numtraits.hpp" 127 #include "TMBad/compile.hpp" 128 #include "TMBad/graph2dot.hpp" 129 #include "TMBad/compression.hpp" 130 #include "TMBad/ad_blas.hpp" 132 #include "TMBad/TMBad.cpp" 134 #define error Rf_error 137 int Integer(
const TMBad::ad_aug &x) CSKIP ({
return (
int) x.Value(); })
139 #define TMBAD_CONDEXP(NAME) \
140 TMBad::ad_aug CondExp ## NAME( \
145 return TMBad::CondExp ## NAME(x0, x1, x2, x3); \
154 bool Variable(
const TMBad::ad_aug &x) CSKIP ({
return !x.constant(); })
173 #include <Rinternals.h>
174 #include
"toggle_thread_safe_R.hpp" 175 void eigen_REprintf(
const char* x)CSKIP({REprintf(
"%s",x);})
177 #include
"tmbutils/tmbutils.hpp" 178 #include
"tmbutils/vectorize.hpp" 185 bool Variable(
double x)CSKIP({
return false; })
189 bool isfinite(
const AD<T> &x)CSKIP({
return isfinite(Value(x)); })
192 bool isinf(
const AD<T> &x)CSKIP({
return isinf(Value(x)); })
195 bool isnan(
const AD<T> &x)CSKIP({
return isnan(Value(x)); })
197 #include
"convert.hpp" 198 #include
"config.hpp" 199 #include
"tmbutils/getListElement.hpp" 200 #include
"atomic_math.hpp" 202 #include
"atomic_convolve.hpp" 203 #include
"tiny_ad/atomic.hpp" 204 #include
"tiny_ad/integrate/integrate.hpp" 205 #include
"dynamic_data.hpp" 206 #include
"Vectorize.hpp" 208 #include
"lgamma.hpp" 209 #include
"start_parallel.hpp" 210 #include
"tmbutils/newton.hpp" 212 #include
"tmb_core.hpp" 214 #include
"distributions_R.hpp" 215 #include
"convenience.hpp" 216 #include
"tmbutils/tmbutils_extra.hpp" 217 #include
"tmbutils/R_inla.hpp" 218 #include
"tmbutils/sparse_matrix_exponential.hpp" 219 #include
"tmbutils/concat.hpp" 220 #include
"precompile.hpp" 229 #define CSKIP(...) __VA_ARGS__ 231 #define CSKIP_ATOMIC(...) __VA_ARGS__ Automatic differentiation library designed for TMB.
Scalar Value() const
Return the underlying scalar value of this ad_aug.
Matrix class used by TMB.
Vector class used by TMB.