tomoto 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +123 -0
  5. data/ext/tomoto/ext.cpp +245 -0
  6. data/ext/tomoto/extconf.rb +28 -0
  7. data/lib/tomoto.rb +12 -0
  8. data/lib/tomoto/ct.rb +11 -0
  9. data/lib/tomoto/hdp.rb +11 -0
  10. data/lib/tomoto/lda.rb +67 -0
  11. data/lib/tomoto/version.rb +3 -0
  12. data/vendor/EigenRand/EigenRand/Core.h +1139 -0
  13. data/vendor/EigenRand/EigenRand/Dists/Basic.h +111 -0
  14. data/vendor/EigenRand/EigenRand/Dists/Discrete.h +877 -0
  15. data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +108 -0
  16. data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +626 -0
  17. data/vendor/EigenRand/EigenRand/EigenRand +19 -0
  18. data/vendor/EigenRand/EigenRand/Macro.h +24 -0
  19. data/vendor/EigenRand/EigenRand/MorePacketMath.h +978 -0
  20. data/vendor/EigenRand/EigenRand/PacketFilter.h +286 -0
  21. data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +624 -0
  22. data/vendor/EigenRand/EigenRand/RandUtils.h +413 -0
  23. data/vendor/EigenRand/EigenRand/doc.h +220 -0
  24. data/vendor/EigenRand/LICENSE +21 -0
  25. data/vendor/EigenRand/README.md +288 -0
  26. data/vendor/eigen/COPYING.BSD +26 -0
  27. data/vendor/eigen/COPYING.GPL +674 -0
  28. data/vendor/eigen/COPYING.LGPL +502 -0
  29. data/vendor/eigen/COPYING.MINPACK +52 -0
  30. data/vendor/eigen/COPYING.MPL2 +373 -0
  31. data/vendor/eigen/COPYING.README +18 -0
  32. data/vendor/eigen/Eigen/CMakeLists.txt +19 -0
  33. data/vendor/eigen/Eigen/Cholesky +46 -0
  34. data/vendor/eigen/Eigen/CholmodSupport +48 -0
  35. data/vendor/eigen/Eigen/Core +537 -0
  36. data/vendor/eigen/Eigen/Dense +7 -0
  37. data/vendor/eigen/Eigen/Eigen +2 -0
  38. data/vendor/eigen/Eigen/Eigenvalues +61 -0
  39. data/vendor/eigen/Eigen/Geometry +62 -0
  40. data/vendor/eigen/Eigen/Householder +30 -0
  41. data/vendor/eigen/Eigen/IterativeLinearSolvers +48 -0
  42. data/vendor/eigen/Eigen/Jacobi +33 -0
  43. data/vendor/eigen/Eigen/LU +50 -0
  44. data/vendor/eigen/Eigen/MetisSupport +35 -0
  45. data/vendor/eigen/Eigen/OrderingMethods +73 -0
  46. data/vendor/eigen/Eigen/PaStiXSupport +48 -0
  47. data/vendor/eigen/Eigen/PardisoSupport +35 -0
  48. data/vendor/eigen/Eigen/QR +51 -0
  49. data/vendor/eigen/Eigen/QtAlignedMalloc +40 -0
  50. data/vendor/eigen/Eigen/SPQRSupport +34 -0
  51. data/vendor/eigen/Eigen/SVD +51 -0
  52. data/vendor/eigen/Eigen/Sparse +36 -0
  53. data/vendor/eigen/Eigen/SparseCholesky +45 -0
  54. data/vendor/eigen/Eigen/SparseCore +69 -0
  55. data/vendor/eigen/Eigen/SparseLU +46 -0
  56. data/vendor/eigen/Eigen/SparseQR +37 -0
  57. data/vendor/eigen/Eigen/StdDeque +27 -0
  58. data/vendor/eigen/Eigen/StdList +26 -0
  59. data/vendor/eigen/Eigen/StdVector +27 -0
  60. data/vendor/eigen/Eigen/SuperLUSupport +64 -0
  61. data/vendor/eigen/Eigen/UmfPackSupport +40 -0
  62. data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +673 -0
  63. data/vendor/eigen/Eigen/src/Cholesky/LLT.h +542 -0
  64. data/vendor/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  65. data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +639 -0
  66. data/vendor/eigen/Eigen/src/Core/Array.h +329 -0
  67. data/vendor/eigen/Eigen/src/Core/ArrayBase.h +226 -0
  68. data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +209 -0
  69. data/vendor/eigen/Eigen/src/Core/Assign.h +90 -0
  70. data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +935 -0
  71. data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +178 -0
  72. data/vendor/eigen/Eigen/src/Core/BandMatrix.h +353 -0
  73. data/vendor/eigen/Eigen/src/Core/Block.h +452 -0
  74. data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +164 -0
  75. data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +160 -0
  76. data/vendor/eigen/Eigen/src/Core/ConditionEstimator.h +175 -0
  77. data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +1688 -0
  78. data/vendor/eigen/Eigen/src/Core/CoreIterators.h +127 -0
  79. data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +184 -0
  80. data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +866 -0
  81. data/vendor/eigen/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  82. data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  83. data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +128 -0
  84. data/vendor/eigen/Eigen/src/Core/DenseBase.h +611 -0
  85. data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +681 -0
  86. data/vendor/eigen/Eigen/src/Core/DenseStorage.h +570 -0
  87. data/vendor/eigen/Eigen/src/Core/Diagonal.h +260 -0
  88. data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +343 -0
  89. data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +28 -0
  90. data/vendor/eigen/Eigen/src/Core/Dot.h +318 -0
  91. data/vendor/eigen/Eigen/src/Core/EigenBase.h +159 -0
  92. data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +146 -0
  93. data/vendor/eigen/Eigen/src/Core/Fuzzy.h +155 -0
  94. data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +455 -0
  95. data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +593 -0
  96. data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +187 -0
  97. data/vendor/eigen/Eigen/src/Core/IO.h +225 -0
  98. data/vendor/eigen/Eigen/src/Core/Inverse.h +118 -0
  99. data/vendor/eigen/Eigen/src/Core/Map.h +171 -0
  100. data/vendor/eigen/Eigen/src/Core/MapBase.h +303 -0
  101. data/vendor/eigen/Eigen/src/Core/MathFunctions.h +1415 -0
  102. data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +101 -0
  103. data/vendor/eigen/Eigen/src/Core/Matrix.h +459 -0
  104. data/vendor/eigen/Eigen/src/Core/MatrixBase.h +529 -0
  105. data/vendor/eigen/Eigen/src/Core/NestByValue.h +110 -0
  106. data/vendor/eigen/Eigen/src/Core/NoAlias.h +108 -0
  107. data/vendor/eigen/Eigen/src/Core/NumTraits.h +248 -0
  108. data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +633 -0
  109. data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +1035 -0
  110. data/vendor/eigen/Eigen/src/Core/Product.h +186 -0
  111. data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +1112 -0
  112. data/vendor/eigen/Eigen/src/Core/Random.h +182 -0
  113. data/vendor/eigen/Eigen/src/Core/Redux.h +505 -0
  114. data/vendor/eigen/Eigen/src/Core/Ref.h +283 -0
  115. data/vendor/eigen/Eigen/src/Core/Replicate.h +142 -0
  116. data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +117 -0
  117. data/vendor/eigen/Eigen/src/Core/Reverse.h +211 -0
  118. data/vendor/eigen/Eigen/src/Core/Select.h +162 -0
  119. data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +352 -0
  120. data/vendor/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  121. data/vendor/eigen/Eigen/src/Core/Solve.h +188 -0
  122. data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +235 -0
  123. data/vendor/eigen/Eigen/src/Core/SolverBase.h +130 -0
  124. data/vendor/eigen/Eigen/src/Core/StableNorm.h +221 -0
  125. data/vendor/eigen/Eigen/src/Core/Stride.h +111 -0
  126. data/vendor/eigen/Eigen/src/Core/Swap.h +67 -0
  127. data/vendor/eigen/Eigen/src/Core/Transpose.h +403 -0
  128. data/vendor/eigen/Eigen/src/Core/Transpositions.h +407 -0
  129. data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +983 -0
  130. data/vendor/eigen/Eigen/src/Core/VectorBlock.h +96 -0
  131. data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +695 -0
  132. data/vendor/eigen/Eigen/src/Core/Visitor.h +273 -0
  133. data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +451 -0
  134. data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +439 -0
  135. data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +637 -0
  136. data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +51 -0
  137. data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +391 -0
  138. data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1316 -0
  139. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +430 -0
  140. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +322 -0
  141. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +1061 -0
  142. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +103 -0
  143. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +674 -0
  144. data/vendor/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +91 -0
  145. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +333 -0
  146. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +1124 -0
  147. data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +212 -0
  148. data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +29 -0
  149. data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +49 -0
  150. data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +490 -0
  151. data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +91 -0
  152. data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +760 -0
  153. data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +471 -0
  154. data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +562 -0
  155. data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +895 -0
  156. data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +77 -0
  157. data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +397 -0
  158. data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +137 -0
  159. data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +945 -0
  160. data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +168 -0
  161. data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +475 -0
  162. data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +188 -0
  163. data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +136 -0
  164. data/vendor/eigen/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  165. data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +792 -0
  166. data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2156 -0
  167. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +492 -0
  168. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +311 -0
  169. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  170. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +122 -0
  171. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +619 -0
  172. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  173. data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +163 -0
  174. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +521 -0
  175. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +287 -0
  176. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +260 -0
  177. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  178. data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  179. data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
  180. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +466 -0
  181. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +315 -0
  182. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  183. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  184. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +335 -0
  185. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +163 -0
  186. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +145 -0
  187. data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +398 -0
  188. data/vendor/eigen/Eigen/src/Core/util/Constants.h +547 -0
  189. data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +83 -0
  190. data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
  191. data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +130 -0
  192. data/vendor/eigen/Eigen/src/Core/util/Macros.h +1001 -0
  193. data/vendor/eigen/Eigen/src/Core/util/Memory.h +993 -0
  194. data/vendor/eigen/Eigen/src/Core/util/Meta.h +534 -0
  195. data/vendor/eigen/Eigen/src/Core/util/NonMPL2.h +3 -0
  196. data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +27 -0
  197. data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +218 -0
  198. data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +821 -0
  199. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
  200. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +459 -0
  201. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  202. data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  203. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
  204. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  205. data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  206. data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  207. data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +654 -0
  208. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +546 -0
  209. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  210. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +870 -0
  211. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  212. data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +556 -0
  213. data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +392 -0
  214. data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +247 -0
  215. data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +114 -0
  216. data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +497 -0
  217. data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +282 -0
  218. data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +234 -0
  219. data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +195 -0
  220. data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +814 -0
  221. data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +199 -0
  222. data/vendor/eigen/Eigen/src/Geometry/RotationBase.h +206 -0
  223. data/vendor/eigen/Eigen/src/Geometry/Scaling.h +170 -0
  224. data/vendor/eigen/Eigen/src/Geometry/Transform.h +1542 -0
  225. data/vendor/eigen/Eigen/src/Geometry/Translation.h +208 -0
  226. data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +166 -0
  227. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +161 -0
  228. data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +103 -0
  229. data/vendor/eigen/Eigen/src/Householder/Householder.h +172 -0
  230. data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +470 -0
  231. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  232. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +228 -0
  233. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +246 -0
  234. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +400 -0
  235. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +462 -0
  236. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +394 -0
  237. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +216 -0
  238. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +115 -0
  239. data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +462 -0
  240. data/vendor/eigen/Eigen/src/LU/Determinant.h +101 -0
  241. data/vendor/eigen/Eigen/src/LU/FullPivLU.h +891 -0
  242. data/vendor/eigen/Eigen/src/LU/InverseImpl.h +415 -0
  243. data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +611 -0
  244. data/vendor/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  245. data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +338 -0
  246. data/vendor/eigen/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  247. data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +445 -0
  248. data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +1843 -0
  249. data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +157 -0
  250. data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  251. data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +543 -0
  252. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +653 -0
  253. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  254. data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +562 -0
  255. data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +676 -0
  256. data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +409 -0
  257. data/vendor/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  258. data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +313 -0
  259. data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +1246 -0
  260. data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +804 -0
  261. data/vendor/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  262. data/vendor/eigen/Eigen/src/SVD/SVDBase.h +315 -0
  263. data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
  264. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +689 -0
  265. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
  266. data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +377 -0
  267. data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +258 -0
  268. data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  269. data/vendor/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  270. data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +216 -0
  271. data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +603 -0
  272. data/vendor/eigen/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  273. data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +341 -0
  274. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +726 -0
  275. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +148 -0
  276. data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +320 -0
  277. data/vendor/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  278. data/vendor/eigen/Eigen/src/SparseCore/SparseDot.h +98 -0
  279. data/vendor/eigen/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  280. data/vendor/eigen/Eigen/src/SparseCore/SparseMap.h +305 -0
  281. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +1403 -0
  282. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +405 -0
  283. data/vendor/eigen/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  284. data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +169 -0
  285. data/vendor/eigen/Eigen/src/SparseCore/SparseRedux.h +49 -0
  286. data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +397 -0
  287. data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +656 -0
  288. data/vendor/eigen/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  289. data/vendor/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  290. data/vendor/eigen/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  291. data/vendor/eigen/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  292. data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +178 -0
  293. data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +478 -0
  294. data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +253 -0
  295. data/vendor/eigen/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  296. data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +773 -0
  297. data/vendor/eigen/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  298. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  299. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  300. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +301 -0
  301. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  302. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  303. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  304. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  305. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
  306. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
  307. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  308. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  309. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  310. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  311. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  312. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  313. data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +745 -0
  314. data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +126 -0
  315. data/vendor/eigen/Eigen/src/StlSupport/StdList.h +106 -0
  316. data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +131 -0
  317. data/vendor/eigen/Eigen/src/StlSupport/details.h +84 -0
  318. data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +1027 -0
  319. data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +506 -0
  320. data/vendor/eigen/Eigen/src/misc/Image.h +82 -0
  321. data/vendor/eigen/Eigen/src/misc/Kernel.h +79 -0
  322. data/vendor/eigen/Eigen/src/misc/RealSvd2x2.h +55 -0
  323. data/vendor/eigen/Eigen/src/misc/blas.h +440 -0
  324. data/vendor/eigen/Eigen/src/misc/lapack.h +152 -0
  325. data/vendor/eigen/Eigen/src/misc/lapacke.h +16291 -0
  326. data/vendor/eigen/Eigen/src/misc/lapacke_mangling.h +17 -0
  327. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +332 -0
  328. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +552 -0
  329. data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +1058 -0
  330. data/vendor/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  331. data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +163 -0
  332. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
  333. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +85 -0
  334. data/vendor/eigen/README.md +3 -0
  335. data/vendor/eigen/bench/README.txt +55 -0
  336. data/vendor/eigen/bench/btl/COPYING +340 -0
  337. data/vendor/eigen/bench/btl/README +154 -0
  338. data/vendor/eigen/bench/tensors/README +21 -0
  339. data/vendor/eigen/blas/README.txt +6 -0
  340. data/vendor/eigen/demos/mandelbrot/README +10 -0
  341. data/vendor/eigen/demos/mix_eigen_and_c/README +9 -0
  342. data/vendor/eigen/demos/opengl/README +13 -0
  343. data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +1760 -0
  344. data/vendor/eigen/unsupported/README.txt +50 -0
  345. data/vendor/tomotopy/LICENSE +21 -0
  346. data/vendor/tomotopy/README.kr.rst +375 -0
  347. data/vendor/tomotopy/README.rst +382 -0
  348. data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +362 -0
  349. data/vendor/tomotopy/src/Labeling/FoRelevance.h +88 -0
  350. data/vendor/tomotopy/src/Labeling/Labeler.h +50 -0
  351. data/vendor/tomotopy/src/TopicModel/CT.h +37 -0
  352. data/vendor/tomotopy/src/TopicModel/CTModel.cpp +13 -0
  353. data/vendor/tomotopy/src/TopicModel/CTModel.hpp +293 -0
  354. data/vendor/tomotopy/src/TopicModel/DMR.h +51 -0
  355. data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +13 -0
  356. data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +374 -0
  357. data/vendor/tomotopy/src/TopicModel/DT.h +65 -0
  358. data/vendor/tomotopy/src/TopicModel/DTM.h +22 -0
  359. data/vendor/tomotopy/src/TopicModel/DTModel.cpp +15 -0
  360. data/vendor/tomotopy/src/TopicModel/DTModel.hpp +572 -0
  361. data/vendor/tomotopy/src/TopicModel/GDMR.h +37 -0
  362. data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +14 -0
  363. data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +485 -0
  364. data/vendor/tomotopy/src/TopicModel/HDP.h +74 -0
  365. data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +13 -0
  366. data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +592 -0
  367. data/vendor/tomotopy/src/TopicModel/HLDA.h +40 -0
  368. data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +13 -0
  369. data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +681 -0
  370. data/vendor/tomotopy/src/TopicModel/HPA.h +27 -0
  371. data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +21 -0
  372. data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +588 -0
  373. data/vendor/tomotopy/src/TopicModel/LDA.h +144 -0
  374. data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +442 -0
  375. data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +13 -0
  376. data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +1058 -0
  377. data/vendor/tomotopy/src/TopicModel/LLDA.h +45 -0
  378. data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +13 -0
  379. data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +203 -0
  380. data/vendor/tomotopy/src/TopicModel/MGLDA.h +63 -0
  381. data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +17 -0
  382. data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +558 -0
  383. data/vendor/tomotopy/src/TopicModel/PA.h +43 -0
  384. data/vendor/tomotopy/src/TopicModel/PAModel.cpp +13 -0
  385. data/vendor/tomotopy/src/TopicModel/PAModel.hpp +467 -0
  386. data/vendor/tomotopy/src/TopicModel/PLDA.h +17 -0
  387. data/vendor/tomotopy/src/TopicModel/PLDAModel.cpp +13 -0
  388. data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +214 -0
  389. data/vendor/tomotopy/src/TopicModel/SLDA.h +54 -0
  390. data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +17 -0
  391. data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +456 -0
  392. data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +692 -0
  393. data/vendor/tomotopy/src/Utils/AliasMethod.hpp +169 -0
  394. data/vendor/tomotopy/src/Utils/Dictionary.h +80 -0
  395. data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +181 -0
  396. data/vendor/tomotopy/src/Utils/LBFGS.h +202 -0
  397. data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBacktracking.h +120 -0
  398. data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBracketing.h +122 -0
  399. data/vendor/tomotopy/src/Utils/LBFGS/Param.h +213 -0
  400. data/vendor/tomotopy/src/Utils/LUT.hpp +82 -0
  401. data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +69 -0
  402. data/vendor/tomotopy/src/Utils/PolyaGamma.hpp +200 -0
  403. data/vendor/tomotopy/src/Utils/PolyaGammaHybrid.hpp +672 -0
  404. data/vendor/tomotopy/src/Utils/ThreadPool.hpp +150 -0
  405. data/vendor/tomotopy/src/Utils/Trie.hpp +220 -0
  406. data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +94 -0
  407. data/vendor/tomotopy/src/Utils/Utils.hpp +337 -0
  408. data/vendor/tomotopy/src/Utils/avx_gamma.h +46 -0
  409. data/vendor/tomotopy/src/Utils/avx_mathfun.h +736 -0
  410. data/vendor/tomotopy/src/Utils/exception.h +28 -0
  411. data/vendor/tomotopy/src/Utils/math.h +281 -0
  412. data/vendor/tomotopy/src/Utils/rtnorm.hpp +2690 -0
  413. data/vendor/tomotopy/src/Utils/sample.hpp +192 -0
  414. data/vendor/tomotopy/src/Utils/serializer.hpp +695 -0
  415. data/vendor/tomotopy/src/Utils/slp.hpp +131 -0
  416. data/vendor/tomotopy/src/Utils/sse_gamma.h +48 -0
  417. data/vendor/tomotopy/src/Utils/sse_mathfun.h +710 -0
  418. data/vendor/tomotopy/src/Utils/text.hpp +49 -0
  419. data/vendor/tomotopy/src/Utils/tvector.hpp +543 -0
  420. metadata +531 -0
@@ -0,0 +1,209 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ //
6
+ // This Source Code Form is subject to the terms of the Mozilla
7
+ // Public License v. 2.0. If a copy of the MPL was not distributed
8
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+
10
+ #ifndef EIGEN_ARRAYWRAPPER_H
11
+ #define EIGEN_ARRAYWRAPPER_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \class ArrayWrapper
16
+ * \ingroup Core_Module
17
+ *
18
+ * \brief Expression of a mathematical vector or matrix as an array object
19
+ *
20
+ * This class is the return type of MatrixBase::array(), and most of the time
21
+ * this is the only way it is use.
22
+ *
23
+ * \sa MatrixBase::array(), class MatrixWrapper
24
+ */
25
+
26
+ namespace internal {
27
+ template<typename ExpressionType>
28
+ struct traits<ArrayWrapper<ExpressionType> >
29
+ : public traits<typename remove_all<typename ExpressionType::Nested>::type >
30
+ {
31
+ typedef ArrayXpr XprKind;
32
+ // Let's remove NestByRefBit
33
+ enum {
34
+ Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
35
+ LvalueBitFlag = is_lvalue<ExpressionType>::value ? LvalueBit : 0,
36
+ Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag
37
+ };
38
+ };
39
+ }
40
+
41
+ template<typename ExpressionType>
42
+ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
43
+ {
44
+ public:
45
+ typedef ArrayBase<ArrayWrapper> Base;
46
+ EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper)
47
+ EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper)
48
+ typedef typename internal::remove_all<ExpressionType>::type NestedExpression;
49
+
50
+ typedef typename internal::conditional<
51
+ internal::is_lvalue<ExpressionType>::value,
52
+ Scalar,
53
+ const Scalar
54
+ >::type ScalarWithConstIfNotLvalue;
55
+
56
+ typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
57
+
58
+ using Base::coeffRef;
59
+
60
+ EIGEN_DEVICE_FUNC
61
+ explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {}
62
+
63
+ EIGEN_DEVICE_FUNC
64
+ inline Index rows() const { return m_expression.rows(); }
65
+ EIGEN_DEVICE_FUNC
66
+ inline Index cols() const { return m_expression.cols(); }
67
+ EIGEN_DEVICE_FUNC
68
+ inline Index outerStride() const { return m_expression.outerStride(); }
69
+ EIGEN_DEVICE_FUNC
70
+ inline Index innerStride() const { return m_expression.innerStride(); }
71
+
72
+ EIGEN_DEVICE_FUNC
73
+ inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
74
+ EIGEN_DEVICE_FUNC
75
+ inline const Scalar* data() const { return m_expression.data(); }
76
+
77
+ EIGEN_DEVICE_FUNC
78
+ inline const Scalar& coeffRef(Index rowId, Index colId) const
79
+ {
80
+ return m_expression.coeffRef(rowId, colId);
81
+ }
82
+
83
+ EIGEN_DEVICE_FUNC
84
+ inline const Scalar& coeffRef(Index index) const
85
+ {
86
+ return m_expression.coeffRef(index);
87
+ }
88
+
89
+ template<typename Dest>
90
+ EIGEN_DEVICE_FUNC
91
+ inline void evalTo(Dest& dst) const { dst = m_expression; }
92
+
93
+ const typename internal::remove_all<NestedExpressionType>::type&
94
+ EIGEN_DEVICE_FUNC
95
+ nestedExpression() const
96
+ {
97
+ return m_expression;
98
+ }
99
+
100
+ /** Forwards the resizing request to the nested expression
101
+ * \sa DenseBase::resize(Index) */
102
+ EIGEN_DEVICE_FUNC
103
+ void resize(Index newSize) { m_expression.resize(newSize); }
104
+ /** Forwards the resizing request to the nested expression
105
+ * \sa DenseBase::resize(Index,Index)*/
106
+ EIGEN_DEVICE_FUNC
107
+ void resize(Index rows, Index cols) { m_expression.resize(rows,cols); }
108
+
109
+ protected:
110
+ NestedExpressionType m_expression;
111
+ };
112
+
113
+ /** \class MatrixWrapper
114
+ * \ingroup Core_Module
115
+ *
116
+ * \brief Expression of an array as a mathematical vector or matrix
117
+ *
118
+ * This class is the return type of ArrayBase::matrix(), and most of the time
119
+ * this is the only way it is use.
120
+ *
121
+ * \sa MatrixBase::matrix(), class ArrayWrapper
122
+ */
123
+
124
+ namespace internal {
125
+ template<typename ExpressionType>
126
+ struct traits<MatrixWrapper<ExpressionType> >
127
+ : public traits<typename remove_all<typename ExpressionType::Nested>::type >
128
+ {
129
+ typedef MatrixXpr XprKind;
130
+ // Let's remove NestByRefBit
131
+ enum {
132
+ Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
133
+ LvalueBitFlag = is_lvalue<ExpressionType>::value ? LvalueBit : 0,
134
+ Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag
135
+ };
136
+ };
137
+ }
138
+
139
+ template<typename ExpressionType>
140
+ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
141
+ {
142
+ public:
143
+ typedef MatrixBase<MatrixWrapper<ExpressionType> > Base;
144
+ EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper)
145
+ EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper)
146
+ typedef typename internal::remove_all<ExpressionType>::type NestedExpression;
147
+
148
+ typedef typename internal::conditional<
149
+ internal::is_lvalue<ExpressionType>::value,
150
+ Scalar,
151
+ const Scalar
152
+ >::type ScalarWithConstIfNotLvalue;
153
+
154
+ typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
155
+
156
+ using Base::coeffRef;
157
+
158
+ EIGEN_DEVICE_FUNC
159
+ explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
160
+
161
+ EIGEN_DEVICE_FUNC
162
+ inline Index rows() const { return m_expression.rows(); }
163
+ EIGEN_DEVICE_FUNC
164
+ inline Index cols() const { return m_expression.cols(); }
165
+ EIGEN_DEVICE_FUNC
166
+ inline Index outerStride() const { return m_expression.outerStride(); }
167
+ EIGEN_DEVICE_FUNC
168
+ inline Index innerStride() const { return m_expression.innerStride(); }
169
+
170
+ EIGEN_DEVICE_FUNC
171
+ inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
172
+ EIGEN_DEVICE_FUNC
173
+ inline const Scalar* data() const { return m_expression.data(); }
174
+
175
+ EIGEN_DEVICE_FUNC
176
+ inline const Scalar& coeffRef(Index rowId, Index colId) const
177
+ {
178
+ return m_expression.derived().coeffRef(rowId, colId);
179
+ }
180
+
181
+ EIGEN_DEVICE_FUNC
182
+ inline const Scalar& coeffRef(Index index) const
183
+ {
184
+ return m_expression.coeffRef(index);
185
+ }
186
+
187
+ EIGEN_DEVICE_FUNC
188
+ const typename internal::remove_all<NestedExpressionType>::type&
189
+ nestedExpression() const
190
+ {
191
+ return m_expression;
192
+ }
193
+
194
+ /** Forwards the resizing request to the nested expression
195
+ * \sa DenseBase::resize(Index) */
196
+ EIGEN_DEVICE_FUNC
197
+ void resize(Index newSize) { m_expression.resize(newSize); }
198
+ /** Forwards the resizing request to the nested expression
199
+ * \sa DenseBase::resize(Index,Index)*/
200
+ EIGEN_DEVICE_FUNC
201
+ void resize(Index rows, Index cols) { m_expression.resize(rows,cols); }
202
+
203
+ protected:
204
+ NestedExpressionType m_expression;
205
+ };
206
+
207
+ } // end namespace Eigen
208
+
209
+ #endif // EIGEN_ARRAYWRAPPER_H
@@ -0,0 +1,90 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2007 Michael Olbrich <michael.olbrich@gmx.net>
5
+ // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
6
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
7
+ //
8
+ // This Source Code Form is subject to the terms of the Mozilla
9
+ // Public License v. 2.0. If a copy of the MPL was not distributed
10
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+
12
+ #ifndef EIGEN_ASSIGN_H
13
+ #define EIGEN_ASSIGN_H
14
+
15
+ namespace Eigen {
16
+
17
+ template<typename Derived>
18
+ template<typename OtherDerived>
19
+ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
20
+ ::lazyAssign(const DenseBase<OtherDerived>& other)
21
+ {
22
+ enum{
23
+ SameType = internal::is_same<typename Derived::Scalar,typename OtherDerived::Scalar>::value
24
+ };
25
+
26
+ EIGEN_STATIC_ASSERT_LVALUE(Derived)
27
+ EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
28
+ EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
29
+
30
+ eigen_assert(rows() == other.rows() && cols() == other.cols());
31
+ internal::call_assignment_no_alias(derived(),other.derived());
32
+
33
+ return derived();
34
+ }
35
+
36
+ template<typename Derived>
37
+ template<typename OtherDerived>
38
+ EIGEN_DEVICE_FUNC
39
+ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
40
+ {
41
+ internal::call_assignment(derived(), other.derived());
42
+ return derived();
43
+ }
44
+
45
+ template<typename Derived>
46
+ EIGEN_DEVICE_FUNC
47
+ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other)
48
+ {
49
+ internal::call_assignment(derived(), other.derived());
50
+ return derived();
51
+ }
52
+
53
+ template<typename Derived>
54
+ EIGEN_DEVICE_FUNC
55
+ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other)
56
+ {
57
+ internal::call_assignment(derived(), other.derived());
58
+ return derived();
59
+ }
60
+
61
+ template<typename Derived>
62
+ template <typename OtherDerived>
63
+ EIGEN_DEVICE_FUNC
64
+ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
65
+ {
66
+ internal::call_assignment(derived(), other.derived());
67
+ return derived();
68
+ }
69
+
70
+ template<typename Derived>
71
+ template <typename OtherDerived>
72
+ EIGEN_DEVICE_FUNC
73
+ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const EigenBase<OtherDerived>& other)
74
+ {
75
+ internal::call_assignment(derived(), other.derived());
76
+ return derived();
77
+ }
78
+
79
+ template<typename Derived>
80
+ template<typename OtherDerived>
81
+ EIGEN_DEVICE_FUNC
82
+ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)
83
+ {
84
+ other.derived().evalTo(derived());
85
+ return derived();
86
+ }
87
+
88
+ } // end namespace Eigen
89
+
90
+ #endif // EIGEN_ASSIGN_H
@@ -0,0 +1,935 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
5
+ // Copyright (C) 2011-2014 Gael Guennebaud <gael.guennebaud@inria.fr>
6
+ // Copyright (C) 2011-2012 Jitse Niesen <jitse@maths.leeds.ac.uk>
7
+ //
8
+ // This Source Code Form is subject to the terms of the Mozilla
9
+ // Public License v. 2.0. If a copy of the MPL was not distributed
10
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+
12
+ #ifndef EIGEN_ASSIGN_EVALUATOR_H
13
+ #define EIGEN_ASSIGN_EVALUATOR_H
14
+
15
+ namespace Eigen {
16
+
17
+ // This implementation is based on Assign.h
18
+
19
+ namespace internal {
20
+
21
+ /***************************************************************************
22
+ * Part 1 : the logic deciding a strategy for traversal and unrolling *
23
+ ***************************************************************************/
24
+
25
+ // copy_using_evaluator_traits is based on assign_traits
26
+
27
+ template <typename DstEvaluator, typename SrcEvaluator, typename AssignFunc>
28
+ struct copy_using_evaluator_traits
29
+ {
30
+ typedef typename DstEvaluator::XprType Dst;
31
+ typedef typename Dst::Scalar DstScalar;
32
+
33
+ enum {
34
+ DstFlags = DstEvaluator::Flags,
35
+ SrcFlags = SrcEvaluator::Flags
36
+ };
37
+
38
+ public:
39
+ enum {
40
+ DstAlignment = DstEvaluator::Alignment,
41
+ SrcAlignment = SrcEvaluator::Alignment,
42
+ DstHasDirectAccess = (DstFlags & DirectAccessBit) == DirectAccessBit,
43
+ JointAlignment = EIGEN_PLAIN_ENUM_MIN(DstAlignment,SrcAlignment)
44
+ };
45
+
46
+ private:
47
+ enum {
48
+ InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime)
49
+ : int(DstFlags)&RowMajorBit ? int(Dst::ColsAtCompileTime)
50
+ : int(Dst::RowsAtCompileTime),
51
+ InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime)
52
+ : int(DstFlags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime)
53
+ : int(Dst::MaxRowsAtCompileTime),
54
+ OuterStride = int(outer_stride_at_compile_time<Dst>::ret),
55
+ MaxSizeAtCompileTime = Dst::SizeAtCompileTime
56
+ };
57
+
58
+ // TODO distinguish between linear traversal and inner-traversals
59
+ typedef typename find_best_packet<DstScalar,Dst::SizeAtCompileTime>::type LinearPacketType;
60
+ typedef typename find_best_packet<DstScalar,InnerSize>::type InnerPacketType;
61
+
62
+ enum {
63
+ LinearPacketSize = unpacket_traits<LinearPacketType>::size,
64
+ InnerPacketSize = unpacket_traits<InnerPacketType>::size
65
+ };
66
+
67
+ public:
68
+ enum {
69
+ LinearRequiredAlignment = unpacket_traits<LinearPacketType>::alignment,
70
+ InnerRequiredAlignment = unpacket_traits<InnerPacketType>::alignment
71
+ };
72
+
73
+ private:
74
+ enum {
75
+ DstIsRowMajor = DstFlags&RowMajorBit,
76
+ SrcIsRowMajor = SrcFlags&RowMajorBit,
77
+ StorageOrdersAgree = (int(DstIsRowMajor) == int(SrcIsRowMajor)),
78
+ MightVectorize = bool(StorageOrdersAgree)
79
+ && (int(DstFlags) & int(SrcFlags) & ActualPacketAccessBit)
80
+ && bool(functor_traits<AssignFunc>::PacketAccess),
81
+ MayInnerVectorize = MightVectorize
82
+ && int(InnerSize)!=Dynamic && int(InnerSize)%int(InnerPacketSize)==0
83
+ && int(OuterStride)!=Dynamic && int(OuterStride)%int(InnerPacketSize)==0
84
+ && (EIGEN_UNALIGNED_VECTORIZE || int(JointAlignment)>=int(InnerRequiredAlignment)),
85
+ MayLinearize = bool(StorageOrdersAgree) && (int(DstFlags) & int(SrcFlags) & LinearAccessBit),
86
+ MayLinearVectorize = bool(MightVectorize) && bool(MayLinearize) && bool(DstHasDirectAccess)
87
+ && (EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)) || MaxSizeAtCompileTime == Dynamic),
88
+ /* If the destination isn't aligned, we have to do runtime checks and we don't unroll,
89
+ so it's only good for large enough sizes. */
90
+ MaySliceVectorize = bool(MightVectorize) && bool(DstHasDirectAccess)
91
+ && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=(EIGEN_UNALIGNED_VECTORIZE?InnerPacketSize:(3*InnerPacketSize)))
92
+ /* slice vectorization can be slow, so we only want it if the slices are big, which is
93
+ indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block
94
+ in a fixed-size matrix
95
+ However, with EIGEN_UNALIGNED_VECTORIZE and unrolling, slice vectorization is still worth it */
96
+ };
97
+
98
+ public:
99
+ enum {
100
+ Traversal = int(MayLinearVectorize) && (LinearPacketSize>InnerPacketSize) ? int(LinearVectorizedTraversal)
101
+ : int(MayInnerVectorize) ? int(InnerVectorizedTraversal)
102
+ : int(MayLinearVectorize) ? int(LinearVectorizedTraversal)
103
+ : int(MaySliceVectorize) ? int(SliceVectorizedTraversal)
104
+ : int(MayLinearize) ? int(LinearTraversal)
105
+ : int(DefaultTraversal),
106
+ Vectorized = int(Traversal) == InnerVectorizedTraversal
107
+ || int(Traversal) == LinearVectorizedTraversal
108
+ || int(Traversal) == SliceVectorizedTraversal
109
+ };
110
+
111
+ typedef typename conditional<int(Traversal)==LinearVectorizedTraversal, LinearPacketType, InnerPacketType>::type PacketType;
112
+
113
+ private:
114
+ enum {
115
+ ActualPacketSize = int(Traversal)==LinearVectorizedTraversal ? LinearPacketSize
116
+ : Vectorized ? InnerPacketSize
117
+ : 1,
118
+ UnrollingLimit = EIGEN_UNROLLING_LIMIT * ActualPacketSize,
119
+ MayUnrollCompletely = int(Dst::SizeAtCompileTime) != Dynamic
120
+ && int(Dst::SizeAtCompileTime) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit),
121
+ MayUnrollInner = int(InnerSize) != Dynamic
122
+ && int(InnerSize) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit)
123
+ };
124
+
125
+ public:
126
+ enum {
127
+ Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal))
128
+ ? (
129
+ int(MayUnrollCompletely) ? int(CompleteUnrolling)
130
+ : int(MayUnrollInner) ? int(InnerUnrolling)
131
+ : int(NoUnrolling)
132
+ )
133
+ : int(Traversal) == int(LinearVectorizedTraversal)
134
+ ? ( bool(MayUnrollCompletely) && ( EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)))
135
+ ? int(CompleteUnrolling)
136
+ : int(NoUnrolling) )
137
+ : int(Traversal) == int(LinearTraversal)
138
+ ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling)
139
+ : int(NoUnrolling) )
140
+ #if EIGEN_UNALIGNED_VECTORIZE
141
+ : int(Traversal) == int(SliceVectorizedTraversal)
142
+ ? ( bool(MayUnrollInner) ? int(InnerUnrolling)
143
+ : int(NoUnrolling) )
144
+ #endif
145
+ : int(NoUnrolling)
146
+ };
147
+
148
+ #ifdef EIGEN_DEBUG_ASSIGN
149
+ static void debug()
150
+ {
151
+ std::cerr << "DstXpr: " << typeid(typename DstEvaluator::XprType).name() << std::endl;
152
+ std::cerr << "SrcXpr: " << typeid(typename SrcEvaluator::XprType).name() << std::endl;
153
+ std::cerr.setf(std::ios::hex, std::ios::basefield);
154
+ std::cerr << "DstFlags" << " = " << DstFlags << " (" << demangle_flags(DstFlags) << " )" << std::endl;
155
+ std::cerr << "SrcFlags" << " = " << SrcFlags << " (" << demangle_flags(SrcFlags) << " )" << std::endl;
156
+ std::cerr.unsetf(std::ios::hex);
157
+ EIGEN_DEBUG_VAR(DstAlignment)
158
+ EIGEN_DEBUG_VAR(SrcAlignment)
159
+ EIGEN_DEBUG_VAR(LinearRequiredAlignment)
160
+ EIGEN_DEBUG_VAR(InnerRequiredAlignment)
161
+ EIGEN_DEBUG_VAR(JointAlignment)
162
+ EIGEN_DEBUG_VAR(InnerSize)
163
+ EIGEN_DEBUG_VAR(InnerMaxSize)
164
+ EIGEN_DEBUG_VAR(LinearPacketSize)
165
+ EIGEN_DEBUG_VAR(InnerPacketSize)
166
+ EIGEN_DEBUG_VAR(ActualPacketSize)
167
+ EIGEN_DEBUG_VAR(StorageOrdersAgree)
168
+ EIGEN_DEBUG_VAR(MightVectorize)
169
+ EIGEN_DEBUG_VAR(MayLinearize)
170
+ EIGEN_DEBUG_VAR(MayInnerVectorize)
171
+ EIGEN_DEBUG_VAR(MayLinearVectorize)
172
+ EIGEN_DEBUG_VAR(MaySliceVectorize)
173
+ std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl;
174
+ EIGEN_DEBUG_VAR(SrcEvaluator::CoeffReadCost)
175
+ EIGEN_DEBUG_VAR(UnrollingLimit)
176
+ EIGEN_DEBUG_VAR(MayUnrollCompletely)
177
+ EIGEN_DEBUG_VAR(MayUnrollInner)
178
+ std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl;
179
+ std::cerr << std::endl;
180
+ }
181
+ #endif
182
+ };
183
+
184
+ /***************************************************************************
185
+ * Part 2 : meta-unrollers
186
+ ***************************************************************************/
187
+
188
+ /************************
189
+ *** Default traversal ***
190
+ ************************/
191
+
192
+ template<typename Kernel, int Index, int Stop>
193
+ struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling
194
+ {
195
+ // FIXME: this is not very clean, perhaps this information should be provided by the kernel?
196
+ typedef typename Kernel::DstEvaluatorType DstEvaluatorType;
197
+ typedef typename DstEvaluatorType::XprType DstXprType;
198
+
199
+ enum {
200
+ outer = Index / DstXprType::InnerSizeAtCompileTime,
201
+ inner = Index % DstXprType::InnerSizeAtCompileTime
202
+ };
203
+
204
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
205
+ {
206
+ kernel.assignCoeffByOuterInner(outer, inner);
207
+ copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, Index+1, Stop>::run(kernel);
208
+ }
209
+ };
210
+
211
+ template<typename Kernel, int Stop>
212
+ struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, Stop, Stop>
213
+ {
214
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { }
215
+ };
216
+
217
+ template<typename Kernel, int Index_, int Stop>
218
+ struct copy_using_evaluator_DefaultTraversal_InnerUnrolling
219
+ {
220
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer)
221
+ {
222
+ kernel.assignCoeffByOuterInner(outer, Index_);
223
+ copy_using_evaluator_DefaultTraversal_InnerUnrolling<Kernel, Index_+1, Stop>::run(kernel, outer);
224
+ }
225
+ };
226
+
227
+ template<typename Kernel, int Stop>
228
+ struct copy_using_evaluator_DefaultTraversal_InnerUnrolling<Kernel, Stop, Stop>
229
+ {
230
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index) { }
231
+ };
232
+
233
+ /***********************
234
+ *** Linear traversal ***
235
+ ***********************/
236
+
237
+ template<typename Kernel, int Index, int Stop>
238
+ struct copy_using_evaluator_LinearTraversal_CompleteUnrolling
239
+ {
240
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel& kernel)
241
+ {
242
+ kernel.assignCoeff(Index);
243
+ copy_using_evaluator_LinearTraversal_CompleteUnrolling<Kernel, Index+1, Stop>::run(kernel);
244
+ }
245
+ };
246
+
247
+ template<typename Kernel, int Stop>
248
+ struct copy_using_evaluator_LinearTraversal_CompleteUnrolling<Kernel, Stop, Stop>
249
+ {
250
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { }
251
+ };
252
+
253
+ /**************************
254
+ *** Inner vectorization ***
255
+ **************************/
256
+
257
+ template<typename Kernel, int Index, int Stop>
258
+ struct copy_using_evaluator_innervec_CompleteUnrolling
259
+ {
260
+ // FIXME: this is not very clean, perhaps this information should be provided by the kernel?
261
+ typedef typename Kernel::DstEvaluatorType DstEvaluatorType;
262
+ typedef typename DstEvaluatorType::XprType DstXprType;
263
+ typedef typename Kernel::PacketType PacketType;
264
+
265
+ enum {
266
+ outer = Index / DstXprType::InnerSizeAtCompileTime,
267
+ inner = Index % DstXprType::InnerSizeAtCompileTime,
268
+ SrcAlignment = Kernel::AssignmentTraits::SrcAlignment,
269
+ DstAlignment = Kernel::AssignmentTraits::DstAlignment
270
+ };
271
+
272
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
273
+ {
274
+ kernel.template assignPacketByOuterInner<DstAlignment, SrcAlignment, PacketType>(outer, inner);
275
+ enum { NextIndex = Index + unpacket_traits<PacketType>::size };
276
+ copy_using_evaluator_innervec_CompleteUnrolling<Kernel, NextIndex, Stop>::run(kernel);
277
+ }
278
+ };
279
+
280
+ template<typename Kernel, int Stop>
281
+ struct copy_using_evaluator_innervec_CompleteUnrolling<Kernel, Stop, Stop>
282
+ {
283
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { }
284
+ };
285
+
286
+ template<typename Kernel, int Index_, int Stop, int SrcAlignment, int DstAlignment>
287
+ struct copy_using_evaluator_innervec_InnerUnrolling
288
+ {
289
+ typedef typename Kernel::PacketType PacketType;
290
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer)
291
+ {
292
+ kernel.template assignPacketByOuterInner<DstAlignment, SrcAlignment, PacketType>(outer, Index_);
293
+ enum { NextIndex = Index_ + unpacket_traits<PacketType>::size };
294
+ copy_using_evaluator_innervec_InnerUnrolling<Kernel, NextIndex, Stop, SrcAlignment, DstAlignment>::run(kernel, outer);
295
+ }
296
+ };
297
+
298
+ template<typename Kernel, int Stop, int SrcAlignment, int DstAlignment>
299
+ struct copy_using_evaluator_innervec_InnerUnrolling<Kernel, Stop, Stop, SrcAlignment, DstAlignment>
300
+ {
301
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &, Index) { }
302
+ };
303
+
304
+ /***************************************************************************
305
+ * Part 3 : implementation of all cases
306
+ ***************************************************************************/
307
+
308
+ // dense_assignment_loop is based on assign_impl
309
+
310
+ template<typename Kernel,
311
+ int Traversal = Kernel::AssignmentTraits::Traversal,
312
+ int Unrolling = Kernel::AssignmentTraits::Unrolling>
313
+ struct dense_assignment_loop;
314
+
315
+ /************************
316
+ *** Default traversal ***
317
+ ************************/
318
+
319
+ template<typename Kernel>
320
+ struct dense_assignment_loop<Kernel, DefaultTraversal, NoUnrolling>
321
+ {
322
+ EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel &kernel)
323
+ {
324
+ for(Index outer = 0; outer < kernel.outerSize(); ++outer) {
325
+ for(Index inner = 0; inner < kernel.innerSize(); ++inner) {
326
+ kernel.assignCoeffByOuterInner(outer, inner);
327
+ }
328
+ }
329
+ }
330
+ };
331
+
332
+ template<typename Kernel>
333
+ struct dense_assignment_loop<Kernel, DefaultTraversal, CompleteUnrolling>
334
+ {
335
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
336
+ {
337
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
338
+ copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, 0, DstXprType::SizeAtCompileTime>::run(kernel);
339
+ }
340
+ };
341
+
342
+ template<typename Kernel>
343
+ struct dense_assignment_loop<Kernel, DefaultTraversal, InnerUnrolling>
344
+ {
345
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
346
+ {
347
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
348
+
349
+ const Index outerSize = kernel.outerSize();
350
+ for(Index outer = 0; outer < outerSize; ++outer)
351
+ copy_using_evaluator_DefaultTraversal_InnerUnrolling<Kernel, 0, DstXprType::InnerSizeAtCompileTime>::run(kernel, outer);
352
+ }
353
+ };
354
+
355
+ /***************************
356
+ *** Linear vectorization ***
357
+ ***************************/
358
+
359
+
360
+ // The goal of unaligned_dense_assignment_loop is simply to factorize the handling
361
+ // of the non vectorizable beginning and ending parts
362
+
363
+ template <bool IsAligned = false>
364
+ struct unaligned_dense_assignment_loop
365
+ {
366
+ // if IsAligned = true, then do nothing
367
+ template <typename Kernel>
368
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index, Index) {}
369
+ };
370
+
371
+ template <>
372
+ struct unaligned_dense_assignment_loop<false>
373
+ {
374
+ // MSVC must not inline this functions. If it does, it fails to optimize the
375
+ // packet access path.
376
+ // FIXME check which version exhibits this issue
377
+ #if EIGEN_COMP_MSVC
378
+ template <typename Kernel>
379
+ static EIGEN_DONT_INLINE void run(Kernel &kernel,
380
+ Index start,
381
+ Index end)
382
+ #else
383
+ template <typename Kernel>
384
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel,
385
+ Index start,
386
+ Index end)
387
+ #endif
388
+ {
389
+ for (Index index = start; index < end; ++index)
390
+ kernel.assignCoeff(index);
391
+ }
392
+ };
393
+
394
+ template<typename Kernel>
395
+ struct dense_assignment_loop<Kernel, LinearVectorizedTraversal, NoUnrolling>
396
+ {
397
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
398
+ {
399
+ const Index size = kernel.size();
400
+ typedef typename Kernel::Scalar Scalar;
401
+ typedef typename Kernel::PacketType PacketType;
402
+ enum {
403
+ requestedAlignment = Kernel::AssignmentTraits::LinearRequiredAlignment,
404
+ packetSize = unpacket_traits<PacketType>::size,
405
+ dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment),
406
+ dstAlignment = packet_traits<Scalar>::AlignedOnScalar ? int(requestedAlignment)
407
+ : int(Kernel::AssignmentTraits::DstAlignment),
408
+ srcAlignment = Kernel::AssignmentTraits::JointAlignment
409
+ };
410
+ const Index alignedStart = dstIsAligned ? 0 : internal::first_aligned<requestedAlignment>(kernel.dstDataPtr(), size);
411
+ const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize;
412
+
413
+ unaligned_dense_assignment_loop<dstIsAligned!=0>::run(kernel, 0, alignedStart);
414
+
415
+ for(Index index = alignedStart; index < alignedEnd; index += packetSize)
416
+ kernel.template assignPacket<dstAlignment, srcAlignment, PacketType>(index);
417
+
418
+ unaligned_dense_assignment_loop<>::run(kernel, alignedEnd, size);
419
+ }
420
+ };
421
+
422
+ template<typename Kernel>
423
+ struct dense_assignment_loop<Kernel, LinearVectorizedTraversal, CompleteUnrolling>
424
+ {
425
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
426
+ {
427
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
428
+ typedef typename Kernel::PacketType PacketType;
429
+
430
+ enum { size = DstXprType::SizeAtCompileTime,
431
+ packetSize =unpacket_traits<PacketType>::size,
432
+ alignedSize = (size/packetSize)*packetSize };
433
+
434
+ copy_using_evaluator_innervec_CompleteUnrolling<Kernel, 0, alignedSize>::run(kernel);
435
+ copy_using_evaluator_DefaultTraversal_CompleteUnrolling<Kernel, alignedSize, size>::run(kernel);
436
+ }
437
+ };
438
+
439
+ /**************************
440
+ *** Inner vectorization ***
441
+ **************************/
442
+
443
+ template<typename Kernel>
444
+ struct dense_assignment_loop<Kernel, InnerVectorizedTraversal, NoUnrolling>
445
+ {
446
+ typedef typename Kernel::PacketType PacketType;
447
+ enum {
448
+ SrcAlignment = Kernel::AssignmentTraits::SrcAlignment,
449
+ DstAlignment = Kernel::AssignmentTraits::DstAlignment
450
+ };
451
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
452
+ {
453
+ const Index innerSize = kernel.innerSize();
454
+ const Index outerSize = kernel.outerSize();
455
+ const Index packetSize = unpacket_traits<PacketType>::size;
456
+ for(Index outer = 0; outer < outerSize; ++outer)
457
+ for(Index inner = 0; inner < innerSize; inner+=packetSize)
458
+ kernel.template assignPacketByOuterInner<DstAlignment, SrcAlignment, PacketType>(outer, inner);
459
+ }
460
+ };
461
+
462
+ template<typename Kernel>
463
+ struct dense_assignment_loop<Kernel, InnerVectorizedTraversal, CompleteUnrolling>
464
+ {
465
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
466
+ {
467
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
468
+ copy_using_evaluator_innervec_CompleteUnrolling<Kernel, 0, DstXprType::SizeAtCompileTime>::run(kernel);
469
+ }
470
+ };
471
+
472
+ template<typename Kernel>
473
+ struct dense_assignment_loop<Kernel, InnerVectorizedTraversal, InnerUnrolling>
474
+ {
475
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
476
+ {
477
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
478
+ typedef typename Kernel::AssignmentTraits Traits;
479
+ const Index outerSize = kernel.outerSize();
480
+ for(Index outer = 0; outer < outerSize; ++outer)
481
+ copy_using_evaluator_innervec_InnerUnrolling<Kernel, 0, DstXprType::InnerSizeAtCompileTime,
482
+ Traits::SrcAlignment, Traits::DstAlignment>::run(kernel, outer);
483
+ }
484
+ };
485
+
486
+ /***********************
487
+ *** Linear traversal ***
488
+ ***********************/
489
+
490
+ template<typename Kernel>
491
+ struct dense_assignment_loop<Kernel, LinearTraversal, NoUnrolling>
492
+ {
493
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
494
+ {
495
+ const Index size = kernel.size();
496
+ for(Index i = 0; i < size; ++i)
497
+ kernel.assignCoeff(i);
498
+ }
499
+ };
500
+
501
+ template<typename Kernel>
502
+ struct dense_assignment_loop<Kernel, LinearTraversal, CompleteUnrolling>
503
+ {
504
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
505
+ {
506
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
507
+ copy_using_evaluator_LinearTraversal_CompleteUnrolling<Kernel, 0, DstXprType::SizeAtCompileTime>::run(kernel);
508
+ }
509
+ };
510
+
511
+ /**************************
512
+ *** Slice vectorization ***
513
+ ***************************/
514
+
515
+ template<typename Kernel>
516
+ struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling>
517
+ {
518
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
519
+ {
520
+ typedef typename Kernel::Scalar Scalar;
521
+ typedef typename Kernel::PacketType PacketType;
522
+ enum {
523
+ packetSize = unpacket_traits<PacketType>::size,
524
+ requestedAlignment = int(Kernel::AssignmentTraits::InnerRequiredAlignment),
525
+ alignable = packet_traits<Scalar>::AlignedOnScalar || int(Kernel::AssignmentTraits::DstAlignment)>=sizeof(Scalar),
526
+ dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment),
527
+ dstAlignment = alignable ? int(requestedAlignment)
528
+ : int(Kernel::AssignmentTraits::DstAlignment)
529
+ };
530
+ const Scalar *dst_ptr = kernel.dstDataPtr();
531
+ if((!bool(dstIsAligned)) && (UIntPtr(dst_ptr) % sizeof(Scalar))>0)
532
+ {
533
+ // the pointer is not aligend-on scalar, so alignment is not possible
534
+ return dense_assignment_loop<Kernel,DefaultTraversal,NoUnrolling>::run(kernel);
535
+ }
536
+ const Index packetAlignedMask = packetSize - 1;
537
+ const Index innerSize = kernel.innerSize();
538
+ const Index outerSize = kernel.outerSize();
539
+ const Index alignedStep = alignable ? (packetSize - kernel.outerStride() % packetSize) & packetAlignedMask : 0;
540
+ Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned<requestedAlignment>(dst_ptr, innerSize);
541
+
542
+ for(Index outer = 0; outer < outerSize; ++outer)
543
+ {
544
+ const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask);
545
+ // do the non-vectorizable part of the assignment
546
+ for(Index inner = 0; inner<alignedStart ; ++inner)
547
+ kernel.assignCoeffByOuterInner(outer, inner);
548
+
549
+ // do the vectorizable part of the assignment
550
+ for(Index inner = alignedStart; inner<alignedEnd; inner+=packetSize)
551
+ kernel.template assignPacketByOuterInner<dstAlignment, Unaligned, PacketType>(outer, inner);
552
+
553
+ // do the non-vectorizable part of the assignment
554
+ for(Index inner = alignedEnd; inner<innerSize ; ++inner)
555
+ kernel.assignCoeffByOuterInner(outer, inner);
556
+
557
+ alignedStart = numext::mini((alignedStart+alignedStep)%packetSize, innerSize);
558
+ }
559
+ }
560
+ };
561
+
562
+ #if EIGEN_UNALIGNED_VECTORIZE
563
+ template<typename Kernel>
564
+ struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, InnerUnrolling>
565
+ {
566
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
567
+ {
568
+ typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
569
+ typedef typename Kernel::PacketType PacketType;
570
+
571
+ enum { size = DstXprType::InnerSizeAtCompileTime,
572
+ packetSize =unpacket_traits<PacketType>::size,
573
+ vectorizableSize = (size/packetSize)*packetSize };
574
+
575
+ for(Index outer = 0; outer < kernel.outerSize(); ++outer)
576
+ {
577
+ copy_using_evaluator_innervec_InnerUnrolling<Kernel, 0, vectorizableSize, 0, 0>::run(kernel, outer);
578
+ copy_using_evaluator_DefaultTraversal_InnerUnrolling<Kernel, vectorizableSize, size>::run(kernel, outer);
579
+ }
580
+ }
581
+ };
582
+ #endif
583
+
584
+
585
+ /***************************************************************************
586
+ * Part 4 : Generic dense assignment kernel
587
+ ***************************************************************************/
588
+
589
+ // This class generalize the assignment of a coefficient (or packet) from one dense evaluator
590
+ // to another dense writable evaluator.
591
+ // It is parametrized by the two evaluators, and the actual assignment functor.
592
+ // This abstraction level permits to keep the evaluation loops as simple and as generic as possible.
593
+ // One can customize the assignment using this generic dense_assignment_kernel with different
594
+ // functors, or by completely overloading it, by-passing a functor.
595
+ template<typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT, typename Functor, int Version = Specialized>
596
+ class generic_dense_assignment_kernel
597
+ {
598
+ protected:
599
+ typedef typename DstEvaluatorTypeT::XprType DstXprType;
600
+ typedef typename SrcEvaluatorTypeT::XprType SrcXprType;
601
+ public:
602
+
603
+ typedef DstEvaluatorTypeT DstEvaluatorType;
604
+ typedef SrcEvaluatorTypeT SrcEvaluatorType;
605
+ typedef typename DstEvaluatorType::Scalar Scalar;
606
+ typedef copy_using_evaluator_traits<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor> AssignmentTraits;
607
+ typedef typename AssignmentTraits::PacketType PacketType;
608
+
609
+
610
+ EIGEN_DEVICE_FUNC generic_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr)
611
+ : m_dst(dst), m_src(src), m_functor(func), m_dstExpr(dstExpr)
612
+ {
613
+ #ifdef EIGEN_DEBUG_ASSIGN
614
+ AssignmentTraits::debug();
615
+ #endif
616
+ }
617
+
618
+ EIGEN_DEVICE_FUNC Index size() const { return m_dstExpr.size(); }
619
+ EIGEN_DEVICE_FUNC Index innerSize() const { return m_dstExpr.innerSize(); }
620
+ EIGEN_DEVICE_FUNC Index outerSize() const { return m_dstExpr.outerSize(); }
621
+ EIGEN_DEVICE_FUNC Index rows() const { return m_dstExpr.rows(); }
622
+ EIGEN_DEVICE_FUNC Index cols() const { return m_dstExpr.cols(); }
623
+ EIGEN_DEVICE_FUNC Index outerStride() const { return m_dstExpr.outerStride(); }
624
+
625
+ EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() { return m_dst; }
626
+ EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const { return m_src; }
627
+
628
+ /// Assign src(row,col) to dst(row,col) through the assignment functor.
629
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col)
630
+ {
631
+ m_functor.assignCoeff(m_dst.coeffRef(row,col), m_src.coeff(row,col));
632
+ }
633
+
634
+ /// \sa assignCoeff(Index,Index)
635
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index index)
636
+ {
637
+ m_functor.assignCoeff(m_dst.coeffRef(index), m_src.coeff(index));
638
+ }
639
+
640
+ /// \sa assignCoeff(Index,Index)
641
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeffByOuterInner(Index outer, Index inner)
642
+ {
643
+ Index row = rowIndexByOuterInner(outer, inner);
644
+ Index col = colIndexByOuterInner(outer, inner);
645
+ assignCoeff(row, col);
646
+ }
647
+
648
+
649
+ template<int StoreMode, int LoadMode, typename PacketType>
650
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index row, Index col)
651
+ {
652
+ m_functor.template assignPacket<StoreMode>(&m_dst.coeffRef(row,col), m_src.template packet<LoadMode,PacketType>(row,col));
653
+ }
654
+
655
+ template<int StoreMode, int LoadMode, typename PacketType>
656
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index index)
657
+ {
658
+ m_functor.template assignPacket<StoreMode>(&m_dst.coeffRef(index), m_src.template packet<LoadMode,PacketType>(index));
659
+ }
660
+
661
+ template<int StoreMode, int LoadMode, typename PacketType>
662
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner)
663
+ {
664
+ Index row = rowIndexByOuterInner(outer, inner);
665
+ Index col = colIndexByOuterInner(outer, inner);
666
+ assignPacket<StoreMode,LoadMode,PacketType>(row, col);
667
+ }
668
+
669
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner)
670
+ {
671
+ typedef typename DstEvaluatorType::ExpressionTraits Traits;
672
+ return int(Traits::RowsAtCompileTime) == 1 ? 0
673
+ : int(Traits::ColsAtCompileTime) == 1 ? inner
674
+ : int(DstEvaluatorType::Flags)&RowMajorBit ? outer
675
+ : inner;
676
+ }
677
+
678
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner)
679
+ {
680
+ typedef typename DstEvaluatorType::ExpressionTraits Traits;
681
+ return int(Traits::ColsAtCompileTime) == 1 ? 0
682
+ : int(Traits::RowsAtCompileTime) == 1 ? inner
683
+ : int(DstEvaluatorType::Flags)&RowMajorBit ? inner
684
+ : outer;
685
+ }
686
+
687
+ EIGEN_DEVICE_FUNC const Scalar* dstDataPtr() const
688
+ {
689
+ return m_dstExpr.data();
690
+ }
691
+
692
+ protected:
693
+ DstEvaluatorType& m_dst;
694
+ const SrcEvaluatorType& m_src;
695
+ const Functor &m_functor;
696
+ // TODO find a way to avoid the needs of the original expression
697
+ DstXprType& m_dstExpr;
698
+ };
699
+
700
+ /***************************************************************************
701
+ * Part 5 : Entry point for dense rectangular assignment
702
+ ***************************************************************************/
703
+
704
+ template<typename DstXprType,typename SrcXprType, typename Functor>
705
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
706
+ void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const Functor &/*func*/)
707
+ {
708
+ EIGEN_ONLY_USED_FOR_DEBUG(dst);
709
+ EIGEN_ONLY_USED_FOR_DEBUG(src);
710
+ eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
711
+ }
712
+
713
+ template<typename DstXprType,typename SrcXprType, typename T1, typename T2>
714
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
715
+ void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const internal::assign_op<T1,T2> &/*func*/)
716
+ {
717
+ Index dstRows = src.rows();
718
+ Index dstCols = src.cols();
719
+ if(((dst.rows()!=dstRows) || (dst.cols()!=dstCols)))
720
+ dst.resize(dstRows, dstCols);
721
+ eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols);
722
+ }
723
+
724
+ template<typename DstXprType, typename SrcXprType, typename Functor>
725
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src, const Functor &func)
726
+ {
727
+ typedef evaluator<DstXprType> DstEvaluatorType;
728
+ typedef evaluator<SrcXprType> SrcEvaluatorType;
729
+
730
+ SrcEvaluatorType srcEvaluator(src);
731
+
732
+ // NOTE To properly handle A = (A*A.transpose())/s with A rectangular,
733
+ // we need to resize the destination after the source evaluator has been created.
734
+ resize_if_allowed(dst, src, func);
735
+
736
+ DstEvaluatorType dstEvaluator(dst);
737
+
738
+ typedef generic_dense_assignment_kernel<DstEvaluatorType,SrcEvaluatorType,Functor> Kernel;
739
+ Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived());
740
+
741
+ dense_assignment_loop<Kernel>::run(kernel);
742
+ }
743
+
744
+ template<typename DstXprType, typename SrcXprType>
745
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src)
746
+ {
747
+ call_dense_assignment_loop(dst, src, internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar>());
748
+ }
749
+
750
+ /***************************************************************************
751
+ * Part 6 : Generic assignment
752
+ ***************************************************************************/
753
+
754
+ // Based on the respective shapes of the destination and source,
755
+ // the class AssignmentKind determine the kind of assignment mechanism.
756
+ // AssignmentKind must define a Kind typedef.
757
+ template<typename DstShape, typename SrcShape> struct AssignmentKind;
758
+
759
+ // Assignement kind defined in this file:
760
+ struct Dense2Dense {};
761
+ struct EigenBase2EigenBase {};
762
+
763
+ template<typename,typename> struct AssignmentKind { typedef EigenBase2EigenBase Kind; };
764
+ template<> struct AssignmentKind<DenseShape,DenseShape> { typedef Dense2Dense Kind; };
765
+
766
+ // This is the main assignment class
767
+ template< typename DstXprType, typename SrcXprType, typename Functor,
768
+ typename Kind = typename AssignmentKind< typename evaluator_traits<DstXprType>::Shape , typename evaluator_traits<SrcXprType>::Shape >::Kind,
769
+ typename EnableIf = void>
770
+ struct Assignment;
771
+
772
+
773
+ // The only purpose of this call_assignment() function is to deal with noalias() / "assume-aliasing" and automatic transposition.
774
+ // Indeed, I (Gael) think that this concept of "assume-aliasing" was a mistake, and it makes thing quite complicated.
775
+ // So this intermediate function removes everything related to "assume-aliasing" such that Assignment
776
+ // does not has to bother about these annoying details.
777
+
778
+ template<typename Dst, typename Src>
779
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
780
+ void call_assignment(Dst& dst, const Src& src)
781
+ {
782
+ call_assignment(dst, src, internal::assign_op<typename Dst::Scalar,typename Src::Scalar>());
783
+ }
784
+ template<typename Dst, typename Src>
785
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
786
+ void call_assignment(const Dst& dst, const Src& src)
787
+ {
788
+ call_assignment(dst, src, internal::assign_op<typename Dst::Scalar,typename Src::Scalar>());
789
+ }
790
+
791
+ // Deal with "assume-aliasing"
792
+ template<typename Dst, typename Src, typename Func>
793
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
794
+ void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if< evaluator_assume_aliasing<Src>::value, void*>::type = 0)
795
+ {
796
+ typename plain_matrix_type<Src>::type tmp(src);
797
+ call_assignment_no_alias(dst, tmp, func);
798
+ }
799
+
800
+ template<typename Dst, typename Src, typename Func>
801
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
802
+ void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if<!evaluator_assume_aliasing<Src>::value, void*>::type = 0)
803
+ {
804
+ call_assignment_no_alias(dst, src, func);
805
+ }
806
+
807
+ // by-pass "assume-aliasing"
808
+ // When there is no aliasing, we require that 'dst' has been properly resized
809
+ template<typename Dst, template <typename> class StorageBase, typename Src, typename Func>
810
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
811
+ void call_assignment(NoAlias<Dst,StorageBase>& dst, const Src& src, const Func& func)
812
+ {
813
+ call_assignment_no_alias(dst.expression(), src, func);
814
+ }
815
+
816
+
817
+ template<typename Dst, typename Src, typename Func>
818
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
819
+ void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func)
820
+ {
821
+ enum {
822
+ NeedToTranspose = ( (int(Dst::RowsAtCompileTime) == 1 && int(Src::ColsAtCompileTime) == 1)
823
+ || (int(Dst::ColsAtCompileTime) == 1 && int(Src::RowsAtCompileTime) == 1)
824
+ ) && int(Dst::SizeAtCompileTime) != 1
825
+ };
826
+
827
+ typedef typename internal::conditional<NeedToTranspose, Transpose<Dst>, Dst>::type ActualDstTypeCleaned;
828
+ typedef typename internal::conditional<NeedToTranspose, Transpose<Dst>, Dst&>::type ActualDstType;
829
+ ActualDstType actualDst(dst);
830
+
831
+ // TODO check whether this is the right place to perform these checks:
832
+ EIGEN_STATIC_ASSERT_LVALUE(Dst)
833
+ EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src)
834
+ EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);
835
+
836
+ Assignment<ActualDstTypeCleaned,Src,Func>::run(actualDst, src, func);
837
+ }
838
+ template<typename Dst, typename Src>
839
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
840
+ void call_assignment_no_alias(Dst& dst, const Src& src)
841
+ {
842
+ call_assignment_no_alias(dst, src, internal::assign_op<typename Dst::Scalar,typename Src::Scalar>());
843
+ }
844
+
845
+ template<typename Dst, typename Src, typename Func>
846
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
847
+ void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src, const Func& func)
848
+ {
849
+ // TODO check whether this is the right place to perform these checks:
850
+ EIGEN_STATIC_ASSERT_LVALUE(Dst)
851
+ EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Dst,Src)
852
+ EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar);
853
+
854
+ Assignment<Dst,Src,Func>::run(dst, src, func);
855
+ }
856
+ template<typename Dst, typename Src>
857
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
858
+ void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src)
859
+ {
860
+ call_assignment_no_alias_no_transpose(dst, src, internal::assign_op<typename Dst::Scalar,typename Src::Scalar>());
861
+ }
862
+
863
+ // forward declaration
864
+ template<typename Dst, typename Src> void check_for_aliasing(const Dst &dst, const Src &src);
865
+
866
+ // Generic Dense to Dense assignment
867
+ // Note that the last template argument "Weak" is needed to make it possible to perform
868
+ // both partial specialization+SFINAE without ambiguous specialization
869
+ template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak>
870
+ struct Assignment<DstXprType, SrcXprType, Functor, Dense2Dense, Weak>
871
+ {
872
+ EIGEN_DEVICE_FUNC
873
+ static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const Functor &func)
874
+ {
875
+ #ifndef EIGEN_NO_DEBUG
876
+ internal::check_for_aliasing(dst, src);
877
+ #endif
878
+
879
+ call_dense_assignment_loop(dst, src, func);
880
+ }
881
+ };
882
+
883
+ // Generic assignment through evalTo.
884
+ // TODO: not sure we have to keep that one, but it helps porting current code to new evaluator mechanism.
885
+ // Note that the last template argument "Weak" is needed to make it possible to perform
886
+ // both partial specialization+SFINAE without ambiguous specialization
887
+ template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak>
888
+ struct Assignment<DstXprType, SrcXprType, Functor, EigenBase2EigenBase, Weak>
889
+ {
890
+ EIGEN_DEVICE_FUNC
891
+ static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar> &/*func*/)
892
+ {
893
+ Index dstRows = src.rows();
894
+ Index dstCols = src.cols();
895
+ if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
896
+ dst.resize(dstRows, dstCols);
897
+
898
+ eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
899
+ src.evalTo(dst);
900
+ }
901
+
902
+ // NOTE The following two functions are templated to avoid their instanciation if not needed
903
+ // This is needed because some expressions supports evalTo only and/or have 'void' as scalar type.
904
+ template<typename SrcScalarType>
905
+ EIGEN_DEVICE_FUNC
906
+ static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op<typename DstXprType::Scalar,SrcScalarType> &/*func*/)
907
+ {
908
+ Index dstRows = src.rows();
909
+ Index dstCols = src.cols();
910
+ if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
911
+ dst.resize(dstRows, dstCols);
912
+
913
+ eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
914
+ src.addTo(dst);
915
+ }
916
+
917
+ template<typename SrcScalarType>
918
+ EIGEN_DEVICE_FUNC
919
+ static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op<typename DstXprType::Scalar,SrcScalarType> &/*func*/)
920
+ {
921
+ Index dstRows = src.rows();
922
+ Index dstCols = src.cols();
923
+ if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
924
+ dst.resize(dstRows, dstCols);
925
+
926
+ eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
927
+ src.subTo(dst);
928
+ }
929
+ };
930
+
931
+ } // namespace internal
932
+
933
+ } // end namespace Eigen
934
+
935
+ #endif // EIGEN_ASSIGN_EVALUATOR_H