// tasmet_types.h // // Author: J.A. de Jong // // Description: // Typedefs and namespace pollution for stuff that is almost always // needed. ////////////////////////////////////////////////////////////////////// #pragma once #ifndef TASMET_TYPES_H #define TASMET_TYPES_H #include // We require C++ #ifndef __cplusplus #error The c++ compiler should be used. #endif // Some header files I (almost) always need #include // C++ std vector #include // C++ string class #include #include // Our linear algebra package typedef size_t us; /* Size type I always use */ #define fillwith arma::fill // Fill vector or matrix with ... // To change the whole code to 32-bit floating points, change this to // float. #if TASMET_FLOAT == 32 typedef float d; /* Shortcut for double */ #elif TASMET_FLOAT == 64 typedef double d; /* Shortcut for double */ #else static_assert(false,"TASMET_FLOAT should be either 32 or 64"); #endif typedef std::complex c; /* Shortcut for c++ complex number */ using arma::abs; using std::string; /* C++ Strings */ using std::vector; // C++ Vectors /* Armadillo functions and objects we often need */ using arma::sin; using arma::cos; using arma::exp; using arma::ones; using arma::zeros; using arma::eye; using arma::inv; using arma::det; using arma::log_det; using arma::norm; using arma::span; using arma::linspace; using arma::diagmat; // Constants // I need these numbers so often, that they can be in the global namespace const c I(0,1); //Complex unity const c sqI=sqrt(I); const d sq2=sqrt(2.0); const c sqmI=sqrt(-1.0*I); const c minI(0,-1); //Minus complex unity const d number_pi=arma::datum::pi; // The number 3.14159265359.. template using vdi = arma::Col::fixed; template using vci = arma::Col::fixed; typedef arma::Col vd; /* Column vector of doubles */ typedef arma::Col vc; /* Column vector of complex numbers */ typedef arma::Col vus; /* Column vector of unsigned integers */ typedef arma::Mat dmat; /* (Dense) Matrix of doubles */ typedef arma::Mat cmat; /* (Dense) matrix of complex numbers */ typedef arma::SpMat sdmat; /* Sparse matrix of doubles */ #endif // TASMET_TYPES_H //////////////////////////////////////////////////////////////////////