Advertisement
Guest User

Aron Ahmadia

a guest
Jan 27th, 2010
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.83 KB | None | 0 0
  1. #include <iostream>
  2. #ifndef EIGEN_CORE_H
  3. #define EIGEN_CORE_H
  4.  
  5. // first thing Eigen does: prevent MSVC from committing suicide
  6. #include "src/Core/util/DisableMSVCWarnings.h"
  7.  
  8. #ifdef _MSC_VER
  9.   #include <malloc.h> // for _aligned_malloc -- need it regardless of whether vectorization is enabled
  10.   #if (_MSC_VER >= 1500) // 2008 or later
  11.     // Remember that usage of defined() in a #define is undefined by the standard.
  12.     // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP.
  13.     #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64)
  14.       #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER
  15.     #endif
  16.   #endif
  17. #endif
  18.  
  19. #ifdef __GNUC__
  20.   #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__>=x && __GNUC_MINOR__>=y) || __GNUC__>x)
  21. #else
  22.   #define EIGEN_GNUC_AT_LEAST(x,y) 0
  23. #endif
  24.  
  25. // Remember that usage of defined() in a #define is undefined by the standard
  26. #if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) )
  27.   #define EIGEN_SSE2_BUT_NOT_OLD_GCC
  28. #endif
  29.  
  30. #ifdef EIGEN_DONT_ALIGN
  31.   #define EIGEN_DONT_VECTORIZE
  32. #endif
  33.  
  34. #ifdef __clang__
  35. #define EIGEN_DONT_VECTORIZE
  36. #endif
  37.  
  38. #ifndef EIGEN_DONT_VECTORIZE
  39.   #if defined (EIGEN_SSE2_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER)
  40.     #define EIGEN_VECTORIZE
  41.     #define EIGEN_VECTORIZE_SSE
  42.     #include <emmintrin.h>
  43.     #include <xmmintrin.h>
  44.     #ifdef __SSE3__
  45.       #include <pmmintrin.h>
  46.     #endif
  47.     #ifdef __SSSE3__
  48.       #include <tmmintrin.h>
  49.     #endif
  50.     #ifdef __SSE4_1__
  51.       #include <smmintrin.h>
  52.     #endif
  53.     #ifdef __SSE4_2__
  54.       #include <nmmintrin.h>
  55.     #endif
  56.   #elif defined __ALTIVEC__
  57.     #define EIGEN_VECTORIZE
  58.     #define EIGEN_VECTORIZE_ALTIVEC
  59.     #include <altivec.h>
  60.     // We need to #undef all these ugly tokens defined in <altivec.h>
  61.     // => use __vector instead of vector
  62.     #undef bool
  63.     #undef vector
  64.     #undef pixel
  65.   #endif
  66. #endif
  67.  
  68. #include <cstdlib>
  69. #include <cmath>
  70. #include <complex>
  71. #include <cassert>
  72. #include <functional>
  73. #include <iostream>
  74. #include <cstring>
  75. #include <string>
  76. #include <limits>
  77. // for min/max:
  78. #include <algorithm>
  79.  
  80. #if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_NO_EXCEPTIONS)
  81.   #define EIGEN_EXCEPTIONS
  82. #endif
  83.  
  84. #ifdef EIGEN_EXCEPTIONS
  85.   #include <new>
  86. #endif
  87.  
  88. // this needs to be done after all possible windows C header includes and before any Eigen source includes
  89. // (system C++ includes are supposed to be able to deal with this already):
  90. // windows.h defines min and max macros which would make Eigen fail to compile.
  91. #if defined(min) || defined(max)
  92. #error The preprocessor symbols 'min' or 'max' are defined. If you are compiling on Windows, do #define NOMINMAX to prevent windows.h from defining these symbols.
  93. #endif
  94.  
  95. // defined in bits/termios.h
  96. #undef B0
  97.  
  98. namespace Eigen {
  99.  
  100. /** \defgroup Core_Module Core module
  101.   * This is the main module of Eigen providing dense matrix and vector support
  102.   * (both fixed and dynamic size) with all the features corresponding to a BLAS library
  103.   * and much more...
  104.   *
  105.   * \code
  106.   * #include <Eigen/Core>
  107.   * \endcode
  108.   */
  109.  
  110. /** The type used to identify a dense storage. */
  111. struct Dense {};
  112.  
  113. #include "src/Core/util/Macros.h"
  114. #include "src/Core/util/Constants.h"
  115. #include "src/Core/util/ForwardDeclarations.h"
  116. #include "src/Core/util/Meta.h"
  117. #include "src/Core/util/XprHelper.h"
  118. #include "src/Core/util/StaticAssert.h"
  119. #include "src/Core/util/Memory.h"
  120.  
  121. #include "src/Core/NumTraits.h"
  122. #include "src/Core/MathFunctions.h"
  123. #include "src/Core/GenericPacketMath.h"
  124.  
  125. #if defined EIGEN_VECTORIZE_SSE
  126.   #include "src/Core/arch/SSE/PacketMath.h"
  127.   #include "src/Core/arch/SSE/MathFunctions.h"
  128. #elif defined EIGEN_VECTORIZE_ALTIVEC
  129.   #include "src/Core/arch/AltiVec/PacketMath.h"
  130. #endif
  131.  
  132. #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
  133. #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8
  134. #endif
  135.  
  136. #include "src/Core/Functors.h"
  137. #include "src/Core/DenseBase.h"
  138. #include "src/Core/MatrixBase.h"
  139. #include "src/Core/AnyMatrixBase.h"
  140. #include "src/Core/Coeffs.h"
  141.  
  142. #ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874
  143.                                 // at least confirmed with Doxygen 1.5.5 and 1.5.6
  144.   #include "src/Core/Assign.h"
  145. #endif
  146.  
  147. #include "src/Core/util/BlasUtil.h"
  148. #include "src/Core/MatrixStorage.h"
  149. #include "src/Core/NestByValue.h"
  150. #include "src/Core/ForceAlignedAccess.h"
  151. #include "src/Core/ReturnByValue.h"
  152. #include "src/Core/NoAlias.h"
  153. #include "src/Core/DenseStorageBase.h"
  154. #include "src/Core/Matrix.h"
  155. #include "src/Core/SelfCwiseBinaryOp.h"
  156. #include "src/Core/CwiseBinaryOp.h"
  157. #include "src/Core/CwiseUnaryOp.h"
  158. #include "src/Core/CwiseNullaryOp.h"
  159. #include "src/Core/CwiseUnaryView.h"
  160. #include "src/Core/Dot.h"
  161. #include "src/Core/StableNorm.h"
  162. #include "src/Core/MapBase.h"
  163. #include "src/Core/Map.h"
  164. #include "src/Core/Block.h"
  165. #include "src/Core/VectorBlock.h"
  166. #include "src/Core/Minor.h"
  167. #include "src/Core/Transpose.h"
  168. #include "src/Core/DiagonalMatrix.h"
  169. #include "src/Core/Diagonal.h"
  170. #include "src/Core/DiagonalProduct.h"
  171. #include "src/Core/PermutationMatrix.h"
  172. #include "src/Core/Redux.h"
  173. #include "src/Core/Visitor.h"
  174. #include "src/Core/Fuzzy.h"
  175. #include "src/Core/IO.h"
  176. #include "src/Core/Swap.h"
  177. #include "src/Core/CommaInitializer.h"
  178. #include "src/Core/ProductBase.h"
  179. #include "src/Core/Product.h"
  180. #include "src/Core/TriangularMatrix.h"
  181. #include "src/Core/SelfAdjointView.h"
  182. #include "src/Core/SolveTriangular.h"
  183. #include "src/Core/products/GeneralUnrolled.h"
  184. #include "src/Core/products/GeneralBlockPanelKernel.h"
  185. #include "src/Core/products/GeneralMatrixVector.h"
  186. #include "src/Core/products/GeneralMatrixMatrix.h"
  187. #include "src/Core/products/SelfadjointMatrixVector.h"
  188. #include "src/Core/products/SelfadjointMatrixMatrix.h"
  189.  
  190. @@ //   #include "src/Core/products/SelfadjointProduct.h"
  191.  
  192. // #include "src/Core/products/SelfadjointRank2Update.h"
  193.  
  194.  // #include "src/Core/products/TriangularMatrixVector.h"
  195.  
  196.  //#include "src/Core/products/TriangularMatrixMatrix.h"
  197.  
  198.   //#include "src/Core/products/TriangularSolverMatrix.h"
  199.  
  200.   //#include "src/Core/BandMatrix.h"
  201.  
  202. }
  203.  
  204.  
  205.  
  206.  
  207. #endif // EIGEN_CORE_H
  208.  
  209. template<class A> class Foo;
  210. template<typename B, typename C> class Bar;
  211. template<typename B, typename C> class FooBar;
  212.  
  213. template<typename B, typename C>
  214. class Bar
  215. {
  216. public:
  217.   B y;
  218.   C z;
  219. };
  220.  
  221. template<class A>
  222. class Foo
  223. {
  224. public:
  225.   A x;
  226. };
  227.  
  228. template <class Derived> struct Base
  229. {
  230.   int b;
  231. };
  232.  
  233. template <typename B, typename C>
  234. struct FooBar : Base< Foo < FooBar<B, C> > >
  235. {
  236.   char c;
  237.  
  238.   template <typename D>
  239.   FooBar& goo(FooBar &_FooBar, D littleD) {std::cout << "goo!" << littleD << std::endl; return _FooBar;}
  240. };
  241.  
  242. int main()
  243. {
  244.   Foo<int> f;
  245.   Foo< Bar<int,short> > g;
  246.   FooBar<char, float> h;  
  247.   FooBar<char, float> i;
  248.  
  249.   h.goo(i, 3);
  250.   return 0;
  251. }
  252.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement