forgeo-gmlib 0.6.2__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (554) hide show
  1. forgeo/gmlib/GeologicalModel3D.py +758 -0
  2. forgeo/gmlib/__init__.py +9 -0
  3. forgeo/gmlib/_version.py +34 -0
  4. forgeo/gmlib/architecture/__init__.py +1 -0
  5. forgeo/gmlib/architecture/core.py +130 -0
  6. forgeo/gmlib/common.abi3.so +0 -0
  7. forgeo/gmlib/fault_network.py +171 -0
  8. forgeo/gmlib/geomodeller_data.py +101 -0
  9. forgeo/gmlib/geomodeller_project.py +396 -0
  10. forgeo/gmlib/myxmltools.py +30 -0
  11. forgeo/gmlib/pypotential2D.abi3.so +0 -0
  12. forgeo/gmlib/pypotential3D.abi3.so +0 -0
  13. forgeo/gmlib/tesselate.py +236 -0
  14. forgeo/gmlib/tesselate_deprecated.py +249 -0
  15. forgeo/gmlib/topography_reader.py +198 -0
  16. forgeo/gmlib/utils/__init__.py +0 -0
  17. forgeo/gmlib/utils/append_data.py +508 -0
  18. forgeo/gmlib/utils/export.py +45 -0
  19. forgeo/gmlib/utils/normalized_gradient.py +40 -0
  20. forgeo/gmlib/utils/tools.py +35 -0
  21. forgeo_gmlib-0.6.2.dist-info/METADATA +23 -0
  22. forgeo_gmlib-0.6.2.dist-info/RECORD +554 -0
  23. forgeo_gmlib-0.6.2.dist-info/WHEEL +5 -0
  24. forgeo_gmlib-0.6.2.dist-info/licenses/LICENSE +661 -0
  25. include/eigen3/Eigen/Cholesky +45 -0
  26. include/eigen3/Eigen/CholmodSupport +48 -0
  27. include/eigen3/Eigen/Core +385 -0
  28. include/eigen3/Eigen/Dense +7 -0
  29. include/eigen3/Eigen/Eigen +2 -0
  30. include/eigen3/Eigen/Eigenvalues +60 -0
  31. include/eigen3/Eigen/Geometry +59 -0
  32. include/eigen3/Eigen/Householder +29 -0
  33. include/eigen3/Eigen/IterativeLinearSolvers +48 -0
  34. include/eigen3/Eigen/Jacobi +32 -0
  35. include/eigen3/Eigen/KLUSupport +41 -0
  36. include/eigen3/Eigen/LU +47 -0
  37. include/eigen3/Eigen/MetisSupport +35 -0
  38. include/eigen3/Eigen/OrderingMethods +70 -0
  39. include/eigen3/Eigen/PaStiXSupport +49 -0
  40. include/eigen3/Eigen/PardisoSupport +35 -0
  41. include/eigen3/Eigen/QR +50 -0
  42. include/eigen3/Eigen/QtAlignedMalloc +39 -0
  43. include/eigen3/Eigen/SPQRSupport +34 -0
  44. include/eigen3/Eigen/SVD +50 -0
  45. include/eigen3/Eigen/Sparse +34 -0
  46. include/eigen3/Eigen/SparseCholesky +37 -0
  47. include/eigen3/Eigen/SparseCore +69 -0
  48. include/eigen3/Eigen/SparseLU +48 -0
  49. include/eigen3/Eigen/SparseQR +36 -0
  50. include/eigen3/Eigen/StdDeque +27 -0
  51. include/eigen3/Eigen/StdList +26 -0
  52. include/eigen3/Eigen/StdVector +27 -0
  53. include/eigen3/Eigen/SuperLUSupport +64 -0
  54. include/eigen3/Eigen/UmfPackSupport +40 -0
  55. include/eigen3/Eigen/src/Cholesky/LDLT.h +688 -0
  56. include/eigen3/Eigen/src/Cholesky/LLT.h +558 -0
  57. include/eigen3/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  58. include/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
  59. include/eigen3/Eigen/src/Core/ArithmeticSequence.h +406 -0
  60. include/eigen3/Eigen/src/Core/Array.h +425 -0
  61. include/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
  62. include/eigen3/Eigen/src/Core/ArrayWrapper.h +209 -0
  63. include/eigen3/Eigen/src/Core/Assign.h +90 -0
  64. include/eigen3/Eigen/src/Core/AssignEvaluator.h +1010 -0
  65. include/eigen3/Eigen/src/Core/Assign_MKL.h +178 -0
  66. include/eigen3/Eigen/src/Core/BandMatrix.h +353 -0
  67. include/eigen3/Eigen/src/Core/Block.h +463 -0
  68. include/eigen3/Eigen/src/Core/BooleanRedux.h +164 -0
  69. include/eigen3/Eigen/src/Core/CommaInitializer.h +164 -0
  70. include/eigen3/Eigen/src/Core/ConditionEstimator.h +175 -0
  71. include/eigen3/Eigen/src/Core/CoreEvaluators.h +1741 -0
  72. include/eigen3/Eigen/src/Core/CoreIterators.h +132 -0
  73. include/eigen3/Eigen/src/Core/CwiseBinaryOp.h +183 -0
  74. include/eigen3/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
  75. include/eigen3/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  76. include/eigen3/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  77. include/eigen3/Eigen/src/Core/CwiseUnaryView.h +132 -0
  78. include/eigen3/Eigen/src/Core/DenseBase.h +701 -0
  79. include/eigen3/Eigen/src/Core/DenseCoeffsBase.h +685 -0
  80. include/eigen3/Eigen/src/Core/DenseStorage.h +652 -0
  81. include/eigen3/Eigen/src/Core/Diagonal.h +259 -0
  82. include/eigen3/Eigen/src/Core/DiagonalMatrix.h +391 -0
  83. include/eigen3/Eigen/src/Core/DiagonalProduct.h +28 -0
  84. include/eigen3/Eigen/src/Core/Dot.h +313 -0
  85. include/eigen3/Eigen/src/Core/EigenBase.h +160 -0
  86. include/eigen3/Eigen/src/Core/ForceAlignedAccess.h +150 -0
  87. include/eigen3/Eigen/src/Core/Fuzzy.h +155 -0
  88. include/eigen3/Eigen/src/Core/GeneralProduct.h +465 -0
  89. include/eigen3/Eigen/src/Core/GenericPacketMath.h +1040 -0
  90. include/eigen3/Eigen/src/Core/GlobalFunctions.h +194 -0
  91. include/eigen3/Eigen/src/Core/IO.h +258 -0
  92. include/eigen3/Eigen/src/Core/IndexedView.h +247 -0
  93. include/eigen3/Eigen/src/Core/Inverse.h +117 -0
  94. include/eigen3/Eigen/src/Core/Map.h +171 -0
  95. include/eigen3/Eigen/src/Core/MapBase.h +310 -0
  96. include/eigen3/Eigen/src/Core/MathFunctions.h +2212 -0
  97. include/eigen3/Eigen/src/Core/MathFunctionsImpl.h +200 -0
  98. include/eigen3/Eigen/src/Core/Matrix.h +578 -0
  99. include/eigen3/Eigen/src/Core/MatrixBase.h +541 -0
  100. include/eigen3/Eigen/src/Core/NestByValue.h +85 -0
  101. include/eigen3/Eigen/src/Core/NoAlias.h +109 -0
  102. include/eigen3/Eigen/src/Core/NumTraits.h +351 -0
  103. include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h +237 -0
  104. include/eigen3/Eigen/src/Core/PermutationMatrix.h +605 -0
  105. include/eigen3/Eigen/src/Core/PlainObjectBase.h +1128 -0
  106. include/eigen3/Eigen/src/Core/Product.h +191 -0
  107. include/eigen3/Eigen/src/Core/ProductEvaluators.h +1179 -0
  108. include/eigen3/Eigen/src/Core/Random.h +218 -0
  109. include/eigen3/Eigen/src/Core/Redux.h +515 -0
  110. include/eigen3/Eigen/src/Core/Ref.h +381 -0
  111. include/eigen3/Eigen/src/Core/Replicate.h +142 -0
  112. include/eigen3/Eigen/src/Core/Reshaped.h +454 -0
  113. include/eigen3/Eigen/src/Core/ReturnByValue.h +119 -0
  114. include/eigen3/Eigen/src/Core/Reverse.h +217 -0
  115. include/eigen3/Eigen/src/Core/Select.h +164 -0
  116. include/eigen3/Eigen/src/Core/SelfAdjointView.h +365 -0
  117. include/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  118. include/eigen3/Eigen/src/Core/Solve.h +188 -0
  119. include/eigen3/Eigen/src/Core/SolveTriangular.h +235 -0
  120. include/eigen3/Eigen/src/Core/SolverBase.h +168 -0
  121. include/eigen3/Eigen/src/Core/StableNorm.h +251 -0
  122. include/eigen3/Eigen/src/Core/StlIterators.h +463 -0
  123. include/eigen3/Eigen/src/Core/Stride.h +120 -0
  124. include/eigen3/Eigen/src/Core/Swap.h +68 -0
  125. include/eigen3/Eigen/src/Core/Transpose.h +464 -0
  126. include/eigen3/Eigen/src/Core/Transpositions.h +386 -0
  127. include/eigen3/Eigen/src/Core/TriangularMatrix.h +994 -0
  128. include/eigen3/Eigen/src/Core/VectorBlock.h +96 -0
  129. include/eigen3/Eigen/src/Core/VectorwiseOp.h +784 -0
  130. include/eigen3/Eigen/src/Core/Visitor.h +381 -0
  131. include/eigen3/Eigen/src/Core/arch/AVX/Complex.h +368 -0
  132. include/eigen3/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
  133. include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h +1588 -0
  134. include/eigen3/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
  135. include/eigen3/Eigen/src/Core/arch/AVX512/Complex.h +384 -0
  136. include/eigen3/Eigen/src/Core/arch/AVX512/MathFunctions.h +361 -0
  137. include/eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h +2270 -0
  138. include/eigen3/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  139. include/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +415 -0
  140. include/eigen3/Eigen/src/Core/arch/AltiVec/MathFunctions.h +119 -0
  141. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2776 -0
  142. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +159 -0
  143. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +627 -0
  144. include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.h +2400 -0
  145. include/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +2743 -0
  146. include/eigen3/Eigen/src/Core/arch/CUDA/Complex.h +269 -0
  147. include/eigen3/Eigen/src/Core/arch/Default/BFloat16.h +688 -0
  148. include/eigen3/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
  149. include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1662 -0
  150. include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +116 -0
  151. include/eigen3/Eigen/src/Core/arch/Default/Half.h +950 -0
  152. include/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
  153. include/eigen3/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  154. include/eigen3/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
  155. include/eigen3/Eigen/src/Core/arch/GPU/PacketMath.h +1646 -0
  156. include/eigen3/Eigen/src/Core/arch/GPU/TypeCasting.h +79 -0
  157. include/eigen3/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  158. include/eigen3/Eigen/src/Core/arch/MSA/Complex.h +645 -0
  159. include/eigen3/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  160. include/eigen3/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  161. include/eigen3/Eigen/src/Core/arch/NEON/Complex.h +560 -0
  162. include/eigen3/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  163. include/eigen3/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
  164. include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +4653 -0
  165. include/eigen3/Eigen/src/Core/arch/NEON/TypeCasting.h +1424 -0
  166. include/eigen3/Eigen/src/Core/arch/SSE/Complex.h +338 -0
  167. include/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
  168. include/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
  169. include/eigen3/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
  170. include/eigen3/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  171. include/eigen3/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  172. include/eigen3/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  173. include/eigen3/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  174. include/eigen3/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  175. include/eigen3/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  176. include/eigen3/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  177. include/eigen3/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  178. include/eigen3/Eigen/src/Core/arch/ZVector/Complex.h +428 -0
  179. include/eigen3/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
  180. include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
  181. include/eigen3/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
  182. include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
  183. include/eigen3/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
  184. include/eigen3/Eigen/src/Core/functors/StlFunctors.h +166 -0
  185. include/eigen3/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  186. include/eigen3/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
  187. include/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
  188. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
  189. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +322 -0
  190. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  191. include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
  192. include/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +523 -0
  193. include/eigen3/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  194. include/eigen3/Eigen/src/Core/products/Parallelizer.h +180 -0
  195. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
  196. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
  197. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
  198. include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  199. include/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  200. include/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
  201. include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
  202. include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
  203. include/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  204. include/eigen3/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  205. include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
  206. include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
  207. include/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
  208. include/eigen3/Eigen/src/Core/util/BlasUtil.h +583 -0
  209. include/eigen3/Eigen/src/Core/util/ConfigureVectorization.h +521 -0
  210. include/eigen3/Eigen/src/Core/util/Constants.h +563 -0
  211. include/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +138 -0
  212. include/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
  213. include/eigen3/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  214. include/eigen3/Eigen/src/Core/util/IntegralConstant.h +272 -0
  215. include/eigen3/Eigen/src/Core/util/MKL_support.h +137 -0
  216. include/eigen3/Eigen/src/Core/util/Macros.h +1511 -0
  217. include/eigen3/Eigen/src/Core/util/Memory.h +1202 -0
  218. include/eigen3/Eigen/src/Core/util/Meta.h +812 -0
  219. include/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
  220. include/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
  221. include/eigen3/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  222. include/eigen3/Eigen/src/Core/util/StaticAssert.h +221 -0
  223. include/eigen3/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  224. include/eigen3/Eigen/src/Core/util/XprHelper.h +856 -0
  225. include/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +345 -0
  226. include/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
  227. include/eigen3/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  228. include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  229. include/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +417 -0
  230. include/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  231. include/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  232. include/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  233. include/eigen3/Eigen/src/Eigenvalues/RealQZ.h +657 -0
  234. include/eigen3/Eigen/src/Eigenvalues/RealSchur.h +557 -0
  235. include/eigen3/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  236. include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
  237. include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  238. include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +560 -0
  239. include/eigen3/Eigen/src/Geometry/AlignedBox.h +486 -0
  240. include/eigen3/Eigen/src/Geometry/AngleAxis.h +247 -0
  241. include/eigen3/Eigen/src/Geometry/EulerAngles.h +114 -0
  242. include/eigen3/Eigen/src/Geometry/Homogeneous.h +501 -0
  243. include/eigen3/Eigen/src/Geometry/Hyperplane.h +282 -0
  244. include/eigen3/Eigen/src/Geometry/OrthoMethods.h +235 -0
  245. include/eigen3/Eigen/src/Geometry/ParametrizedLine.h +232 -0
  246. include/eigen3/Eigen/src/Geometry/Quaternion.h +870 -0
  247. include/eigen3/Eigen/src/Geometry/Rotation2D.h +199 -0
  248. include/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
  249. include/eigen3/Eigen/src/Geometry/Scaling.h +188 -0
  250. include/eigen3/Eigen/src/Geometry/Transform.h +1566 -0
  251. include/eigen3/Eigen/src/Geometry/Translation.h +202 -0
  252. include/eigen3/Eigen/src/Geometry/Umeyama.h +168 -0
  253. include/eigen3/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  254. include/eigen3/Eigen/src/Householder/BlockHouseholder.h +110 -0
  255. include/eigen3/Eigen/src/Householder/Householder.h +176 -0
  256. include/eigen3/Eigen/src/Householder/HouseholderSequence.h +553 -0
  257. include/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  258. include/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
  259. include/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +227 -0
  260. include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
  261. include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
  262. include/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
  263. include/eigen3/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
  264. include/eigen3/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
  265. include/eigen3/Eigen/src/Jacobi/Jacobi.h +483 -0
  266. include/eigen3/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  267. include/eigen3/Eigen/src/LU/Determinant.h +117 -0
  268. include/eigen3/Eigen/src/LU/FullPivLU.h +877 -0
  269. include/eigen3/Eigen/src/LU/InverseImpl.h +432 -0
  270. include/eigen3/Eigen/src/LU/PartialPivLU.h +624 -0
  271. include/eigen3/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  272. include/eigen3/Eigen/src/LU/arch/InverseSize4.h +363 -0
  273. include/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  274. include/eigen3/Eigen/src/OrderingMethods/Amd.h +435 -0
  275. include/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
  276. include/eigen3/Eigen/src/OrderingMethods/Ordering.h +153 -0
  277. include/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  278. include/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
  279. include/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
  280. include/eigen3/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  281. include/eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
  282. include/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
  283. include/eigen3/Eigen/src/QR/HouseholderQR.h +434 -0
  284. include/eigen3/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  285. include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
  286. include/eigen3/Eigen/src/SVD/BDCSVD.h +1377 -0
  287. include/eigen3/Eigen/src/SVD/JacobiSVD.h +813 -0
  288. include/eigen3/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  289. include/eigen3/Eigen/src/SVD/SVDBase.h +376 -0
  290. include/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +415 -0
  291. include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
  292. include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
  293. include/eigen3/Eigen/src/SparseCore/AmbiVector.h +378 -0
  294. include/eigen3/Eigen/src/SparseCore/CompressedStorage.h +274 -0
  295. include/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  296. include/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  297. include/eigen3/Eigen/src/SparseCore/SparseAssign.h +270 -0
  298. include/eigen3/Eigen/src/SparseCore/SparseBlock.h +566 -0
  299. include/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  300. include/eigen3/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
  301. include/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
  302. include/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
  303. include/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
  304. include/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  305. include/eigen3/Eigen/src/SparseCore/SparseDot.h +98 -0
  306. include/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  307. include/eigen3/Eigen/src/SparseCore/SparseMap.h +306 -0
  308. include/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
  309. include/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +399 -0
  310. include/eigen3/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  311. include/eigen3/Eigen/src/SparseCore/SparseProduct.h +182 -0
  312. include/eigen3/Eigen/src/SparseCore/SparseRedux.h +49 -0
  313. include/eigen3/Eigen/src/SparseCore/SparseRef.h +397 -0
  314. include/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
  315. include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  316. include/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  317. include/eigen3/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  318. include/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  319. include/eigen3/Eigen/src/SparseCore/SparseUtil.h +186 -0
  320. include/eigen3/Eigen/src/SparseCore/SparseVector.h +480 -0
  321. include/eigen3/Eigen/src/SparseCore/SparseView.h +254 -0
  322. include/eigen3/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  323. include/eigen3/Eigen/src/SparseLU/SparseLU.h +925 -0
  324. include/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  325. include/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  326. include/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  327. include/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +374 -0
  328. include/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  329. include/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  330. include/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  331. include/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  332. include/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +121 -0
  333. include/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +129 -0
  334. include/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +222 -0
  335. include/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  336. include/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  337. include/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  338. include/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  339. include/eigen3/Eigen/src/SparseQR/SparseQR.h +758 -0
  340. include/eigen3/Eigen/src/StlSupport/StdDeque.h +116 -0
  341. include/eigen3/Eigen/src/StlSupport/StdList.h +106 -0
  342. include/eigen3/Eigen/src/StlSupport/StdVector.h +131 -0
  343. include/eigen3/Eigen/src/StlSupport/details.h +84 -0
  344. include/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
  345. include/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
  346. include/eigen3/Eigen/src/misc/Image.h +82 -0
  347. include/eigen3/Eigen/src/misc/Kernel.h +79 -0
  348. include/eigen3/Eigen/src/misc/RealSvd2x2.h +55 -0
  349. include/eigen3/Eigen/src/misc/blas.h +440 -0
  350. include/eigen3/Eigen/src/misc/lapack.h +152 -0
  351. include/eigen3/Eigen/src/misc/lapacke.h +16292 -0
  352. include/eigen3/Eigen/src/misc/lapacke_mangling.h +17 -0
  353. include/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +431 -0
  354. include/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
  355. include/eigen3/Eigen/src/plugins/BlockMethods.h +1442 -0
  356. include/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  357. include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
  358. include/eigen3/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  359. include/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +184 -0
  360. include/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
  361. include/eigen3/Eigen/src/plugins/ReshapedMethods.h +149 -0
  362. include/eigen3/signature_of_eigen3_matrix_library +1 -0
  363. include/eigen3/unsupported/Eigen/AdolcForward +159 -0
  364. include/eigen3/unsupported/Eigen/AlignedVector3 +234 -0
  365. include/eigen3/unsupported/Eigen/ArpackSupport +30 -0
  366. include/eigen3/unsupported/Eigen/AutoDiff +48 -0
  367. include/eigen3/unsupported/Eigen/BVH +95 -0
  368. include/eigen3/unsupported/Eigen/CXX11/Tensor +137 -0
  369. include/eigen3/unsupported/Eigen/CXX11/TensorSymmetry +42 -0
  370. include/eigen3/unsupported/Eigen/CXX11/ThreadPool +74 -0
  371. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +554 -0
  372. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h +327 -0
  373. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h +242 -0
  374. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +1176 -0
  375. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h +1559 -0
  376. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h +1083 -0
  377. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h +510 -0
  378. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h +373 -0
  379. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h +1019 -0
  380. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h +73 -0
  381. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h +6 -0
  382. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h +1413 -0
  383. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h +575 -0
  384. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h +1650 -0
  385. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +1679 -0
  386. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h +455 -0
  387. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h +1126 -0
  388. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h +536 -0
  389. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h +213 -0
  390. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h +342 -0
  391. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h +137 -0
  392. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h +6 -0
  393. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h +104 -0
  394. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h +389 -0
  395. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h +1048 -0
  396. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +409 -0
  397. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h +234 -0
  398. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +493 -0
  399. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h +229 -0
  400. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h +980 -0
  401. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +701 -0
  402. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h +389 -0
  403. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h +669 -0
  404. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +377 -0
  405. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h +232 -0
  406. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h +191 -0
  407. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +488 -0
  408. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h +297 -0
  409. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h +33 -0
  410. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h +99 -0
  411. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.h +44 -0
  412. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h +79 -0
  413. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h +602 -0
  414. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +735 -0
  415. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h +244 -0
  416. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h +82 -0
  417. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +257 -0
  418. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h +213 -0
  419. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h +98 -0
  420. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +327 -0
  421. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h +311 -0
  422. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +1098 -0
  423. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +705 -0
  424. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h +286 -0
  425. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h +317 -0
  426. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +1000 -0
  427. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h +6 -0
  428. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h +973 -0
  429. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h +582 -0
  430. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h +454 -0
  431. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h +462 -0
  432. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h +528 -0
  433. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h +513 -0
  434. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h +466 -0
  435. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h +157 -0
  436. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h +341 -0
  437. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h +299 -0
  438. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +264 -0
  439. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h +249 -0
  440. include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h +628 -0
  441. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h +293 -0
  442. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h +236 -0
  443. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/Symmetry.h +338 -0
  444. include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h +669 -0
  445. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/Barrier.h +67 -0
  446. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h +249 -0
  447. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h +486 -0
  448. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h +236 -0
  449. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h +23 -0
  450. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h +40 -0
  451. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h +301 -0
  452. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h +48 -0
  453. include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h +20 -0
  454. include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Meta.h +538 -0
  455. include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h +88 -0
  456. include/eigen3/unsupported/Eigen/CXX11/src/util/EmulateArray.h +261 -0
  457. include/eigen3/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h +158 -0
  458. include/eigen3/unsupported/Eigen/EulerAngles +43 -0
  459. include/eigen3/unsupported/Eigen/FFT +420 -0
  460. include/eigen3/unsupported/Eigen/IterativeSolvers +51 -0
  461. include/eigen3/unsupported/Eigen/KroneckerProduct +36 -0
  462. include/eigen3/unsupported/Eigen/LevenbergMarquardt +49 -0
  463. include/eigen3/unsupported/Eigen/MPRealSupport +213 -0
  464. include/eigen3/unsupported/Eigen/MatrixFunctions +504 -0
  465. include/eigen3/unsupported/Eigen/MoreVectorization +24 -0
  466. include/eigen3/unsupported/Eigen/NonLinearOptimization +140 -0
  467. include/eigen3/unsupported/Eigen/NumericalDiff +56 -0
  468. include/eigen3/unsupported/Eigen/OpenGLSupport +322 -0
  469. include/eigen3/unsupported/Eigen/Polynomials +137 -0
  470. include/eigen3/unsupported/Eigen/Skyline +39 -0
  471. include/eigen3/unsupported/Eigen/SparseExtra +54 -0
  472. include/eigen3/unsupported/Eigen/SpecialFunctions +103 -0
  473. include/eigen3/unsupported/Eigen/Splines +35 -0
  474. include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h +108 -0
  475. include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +730 -0
  476. include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h +220 -0
  477. include/eigen3/unsupported/Eigen/src/BVH/BVAlgorithms.h +293 -0
  478. include/eigen3/unsupported/Eigen/src/BVH/KdBVH.h +223 -0
  479. include/eigen3/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h +790 -0
  480. include/eigen3/unsupported/Eigen/src/EulerAngles/EulerAngles.h +356 -0
  481. include/eigen3/unsupported/Eigen/src/EulerAngles/EulerSystem.h +306 -0
  482. include/eigen3/unsupported/Eigen/src/FFT/ei_fftw_impl.h +261 -0
  483. include/eigen3/unsupported/Eigen/src/FFT/ei_kissfft_impl.h +449 -0
  484. include/eigen3/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h +187 -0
  485. include/eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h +511 -0
  486. include/eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h +335 -0
  487. include/eigen3/unsupported/Eigen/src/IterativeSolvers/IDRS.h +436 -0
  488. include/eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h +90 -0
  489. include/eigen3/unsupported/Eigen/src/IterativeSolvers/IterationController.h +154 -0
  490. include/eigen3/unsupported/Eigen/src/IterativeSolvers/MINRES.h +267 -0
  491. include/eigen3/unsupported/Eigen/src/IterativeSolvers/Scaling.h +193 -0
  492. include/eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h +305 -0
  493. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h +84 -0
  494. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h +202 -0
  495. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h +160 -0
  496. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h +188 -0
  497. include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h +396 -0
  498. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +441 -0
  499. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h +569 -0
  500. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +373 -0
  501. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +705 -0
  502. include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h +368 -0
  503. include/eigen3/unsupported/Eigen/src/MatrixFunctions/StemFunction.h +117 -0
  504. include/eigen3/unsupported/Eigen/src/MoreVectorization/MathFunctions.h +95 -0
  505. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h +601 -0
  506. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h +657 -0
  507. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/chkder.h +66 -0
  508. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/covar.h +70 -0
  509. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/dogleg.h +107 -0
  510. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h +79 -0
  511. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/lmpar.h +298 -0
  512. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h +91 -0
  513. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h +30 -0
  514. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1updt.h +99 -0
  515. include/eigen3/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h +49 -0
  516. include/eigen3/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h +130 -0
  517. include/eigen3/unsupported/Eigen/src/Polynomials/Companion.h +280 -0
  518. include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialSolver.h +429 -0
  519. include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialUtils.h +143 -0
  520. include/eigen3/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h +352 -0
  521. include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrix.h +862 -0
  522. include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h +212 -0
  523. include/eigen3/unsupported/Eigen/src/Skyline/SkylineProduct.h +295 -0
  524. include/eigen3/unsupported/Eigen/src/Skyline/SkylineStorage.h +259 -0
  525. include/eigen3/unsupported/Eigen/src/Skyline/SkylineUtil.h +89 -0
  526. include/eigen3/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h +122 -0
  527. include/eigen3/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h +1079 -0
  528. include/eigen3/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h +404 -0
  529. include/eigen3/unsupported/Eigen/src/SparseExtra/MarketIO.h +282 -0
  530. include/eigen3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h +247 -0
  531. include/eigen3/unsupported/Eigen/src/SparseExtra/RandomSetter.h +349 -0
  532. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsArrayAPI.h +286 -0
  533. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsBFloat16.h +68 -0
  534. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsFunctors.h +357 -0
  535. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsHalf.h +66 -0
  536. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h +1959 -0
  537. include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsPacketMath.h +118 -0
  538. include/eigen3/unsupported/Eigen/src/SpecialFunctions/HipVectorCompatibility.h +67 -0
  539. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h +167 -0
  540. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsBFloat16.h +58 -0
  541. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsFunctors.h +330 -0
  542. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h +58 -0
  543. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +2051 -0
  544. include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsPacketMath.h +79 -0
  545. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/BesselFunctions.h +46 -0
  546. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/SpecialFunctions.h +16 -0
  547. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/BesselFunctions.h +51 -0
  548. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/SpecialFunctions.h +16 -0
  549. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/GPU/SpecialFunctions.h +369 -0
  550. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/BesselFunctions.h +54 -0
  551. include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/SpecialFunctions.h +34 -0
  552. include/eigen3/unsupported/Eigen/src/Splines/Spline.h +507 -0
  553. include/eigen3/unsupported/Eigen/src/Splines/SplineFitting.h +431 -0
  554. include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h +93 -0
@@ -0,0 +1,2743 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008-2016 Konstantinos Margaritis <markos@freevec.org>
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_PACKET_MATH_ALTIVEC_H
11
+ #define EIGEN_PACKET_MATH_ALTIVEC_H
12
+
13
+ namespace Eigen {
14
+
15
+ namespace internal {
16
+
17
+ #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
18
+ #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 4
19
+ #endif
20
+
21
+ #ifndef EIGEN_HAS_SINGLE_INSTRUCTION_MADD
22
+ #define EIGEN_HAS_SINGLE_INSTRUCTION_MADD
23
+ #endif
24
+
25
+ // NOTE Altivec has 32 registers, but Eigen only accepts a value of 8 or 16
26
+ #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS
27
+ #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 32
28
+ #endif
29
+
30
+ typedef __vector float Packet4f;
31
+ typedef __vector int Packet4i;
32
+ typedef __vector unsigned int Packet4ui;
33
+ typedef __vector __bool int Packet4bi;
34
+ typedef __vector short int Packet8s;
35
+ typedef __vector unsigned short int Packet8us;
36
+ typedef __vector signed char Packet16c;
37
+ typedef __vector unsigned char Packet16uc;
38
+ typedef eigen_packet_wrapper<__vector unsigned short int,0> Packet8bf;
39
+
40
+ // We don't want to write the same code all the time, but we need to reuse the constants
41
+ // and it doesn't really work to declare them global, so we define macros instead
42
+ #define _EIGEN_DECLARE_CONST_FAST_Packet4f(NAME,X) \
43
+ Packet4f p4f_##NAME = {X, X, X, X}
44
+
45
+ #define _EIGEN_DECLARE_CONST_FAST_Packet4i(NAME,X) \
46
+ Packet4i p4i_##NAME = vec_splat_s32(X)
47
+
48
+ #define _EIGEN_DECLARE_CONST_FAST_Packet4ui(NAME,X) \
49
+ Packet4ui p4ui_##NAME = {X, X, X, X}
50
+
51
+ #define _EIGEN_DECLARE_CONST_FAST_Packet8us(NAME,X) \
52
+ Packet8us p8us_##NAME = {X, X, X, X, X, X, X, X}
53
+
54
+ #define _EIGEN_DECLARE_CONST_FAST_Packet16uc(NAME,X) \
55
+ Packet16uc p16uc_##NAME = {X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X}
56
+
57
+ #define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \
58
+ Packet4f p4f_##NAME = pset1<Packet4f>(X)
59
+
60
+ #define _EIGEN_DECLARE_CONST_Packet4i(NAME,X) \
61
+ Packet4i p4i_##NAME = pset1<Packet4i>(X)
62
+
63
+ #define _EIGEN_DECLARE_CONST_Packet2d(NAME,X) \
64
+ Packet2d p2d_##NAME = pset1<Packet2d>(X)
65
+
66
+ #define _EIGEN_DECLARE_CONST_Packet2l(NAME,X) \
67
+ Packet2l p2l_##NAME = pset1<Packet2l>(X)
68
+
69
+ #define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \
70
+ const Packet4f p4f_##NAME = reinterpret_cast<Packet4f>(pset1<Packet4i>(X))
71
+
72
+ #define DST_CHAN 1
73
+ #define DST_CTRL(size, count, stride) (((size) << 24) | ((count) << 16) | (stride))
74
+ #define __UNPACK_TYPE__(PACKETNAME) typename unpacket_traits<PACKETNAME>::type
75
+
76
+ // These constants are endian-agnostic
77
+ static _EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0); //{ 0.0, 0.0, 0.0, 0.0}
78
+ static _EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0); //{ 0, 0, 0, 0,}
79
+ static _EIGEN_DECLARE_CONST_FAST_Packet4i(ONE,1); //{ 1, 1, 1, 1}
80
+ static _EIGEN_DECLARE_CONST_FAST_Packet4i(MINUS16,-16); //{ -16, -16, -16, -16}
81
+ static _EIGEN_DECLARE_CONST_FAST_Packet4i(MINUS1,-1); //{ -1, -1, -1, -1}
82
+ static _EIGEN_DECLARE_CONST_FAST_Packet4ui(SIGN, 0x80000000u);
83
+ static _EIGEN_DECLARE_CONST_FAST_Packet4ui(PREV0DOT5, 0x3EFFFFFFu);
84
+ static _EIGEN_DECLARE_CONST_FAST_Packet8us(ONE,1); //{ 1, 1, 1, 1, 1, 1, 1, 1}
85
+ static _EIGEN_DECLARE_CONST_FAST_Packet16uc(ONE,1);
86
+ static Packet4f p4f_MZERO = (Packet4f) vec_sl((Packet4ui)p4i_MINUS1, (Packet4ui)p4i_MINUS1); //{ 0x80000000, 0x80000000, 0x80000000, 0x80000000}
87
+ #ifndef EIGEN_VECTORIZE_VSX
88
+ static Packet4f p4f_ONE = vec_ctf(p4i_ONE, 0); //{ 1.0, 1.0, 1.0, 1.0}
89
+ #endif
90
+
91
+ static Packet4f p4f_COUNTDOWN = { 0.0, 1.0, 2.0, 3.0 };
92
+ static Packet4i p4i_COUNTDOWN = { 0, 1, 2, 3 };
93
+ static Packet8s p8s_COUNTDOWN = { 0, 1, 2, 3, 4, 5, 6, 7 };
94
+ static Packet8us p8us_COUNTDOWN = { 0, 1, 2, 3, 4, 5, 6, 7 };
95
+
96
+ static Packet16c p16c_COUNTDOWN = { 0, 1, 2, 3, 4, 5, 6, 7,
97
+ 8, 9, 10, 11, 12, 13, 14, 15};
98
+ static Packet16uc p16uc_COUNTDOWN = { 0, 1, 2, 3, 4, 5, 6, 7,
99
+ 8, 9, 10, 11, 12, 13, 14, 15};
100
+
101
+ static Packet16uc p16uc_REVERSE32 = { 12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3 };
102
+ static Packet16uc p16uc_REVERSE16 = { 14,15, 12,13, 10,11, 8,9, 6,7, 4,5, 2,3, 0,1 };
103
+ static Packet16uc p16uc_REVERSE8 = { 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
104
+
105
+ static Packet16uc p16uc_DUPLICATE32_HI = { 0,1,2,3, 0,1,2,3, 4,5,6,7, 4,5,6,7 };
106
+ static Packet16uc p16uc_DUPLICATE16_HI = { 0,1,0,1, 2,3,2,3, 4,5,4,5, 6,7,6,7 };
107
+ static Packet16uc p16uc_DUPLICATE8_HI = { 0,0, 1,1, 2,2, 3,3, 4,4, 5,5, 6,6, 7,7 };
108
+ static const Packet16uc p16uc_DUPLICATE16_EVEN= { 0,1 ,0,1, 4,5, 4,5, 8,9, 8,9, 12,13, 12,13 };
109
+ static const Packet16uc p16uc_DUPLICATE16_ODD = { 2,3 ,2,3, 6,7, 6,7, 10,11, 10,11, 14,15, 14,15 };
110
+
111
+ static Packet16uc p16uc_QUADRUPLICATE16_HI = { 0,1,0,1,0,1,0,1, 2,3,2,3,2,3,2,3 };
112
+
113
+ // Handle endianness properly while loading constants
114
+ // Define global static constants:
115
+ #ifdef _BIG_ENDIAN
116
+ static Packet16uc p16uc_FORWARD = vec_lvsl(0, (float*)0);
117
+ #ifdef EIGEN_VECTORIZE_VSX
118
+ static Packet16uc p16uc_REVERSE64 = { 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };
119
+ #endif
120
+ static Packet16uc p16uc_PSET32_WODD = vec_sld((Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 0), (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 2), 8);//{ 0,1,2,3, 0,1,2,3, 8,9,10,11, 8,9,10,11 };
121
+ static Packet16uc p16uc_PSET32_WEVEN = vec_sld(p16uc_DUPLICATE32_HI, (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 3), 8);//{ 4,5,6,7, 4,5,6,7, 12,13,14,15, 12,13,14,15 };
122
+ static Packet16uc p16uc_HALF64_0_16 = vec_sld((Packet16uc)p4i_ZERO, vec_splat((Packet16uc) vec_abs(p4i_MINUS16), 3), 8); //{ 0,0,0,0, 0,0,0,0, 16,16,16,16, 16,16,16,16};
123
+ #else
124
+ static Packet16uc p16uc_FORWARD = p16uc_REVERSE32;
125
+ static Packet16uc p16uc_REVERSE64 = { 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };
126
+ static Packet16uc p16uc_PSET32_WODD = vec_sld((Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 1), (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 3), 8);//{ 0,1,2,3, 0,1,2,3, 8,9,10,11, 8,9,10,11 };
127
+ static Packet16uc p16uc_PSET32_WEVEN = vec_sld((Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 0), (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 2), 8);//{ 4,5,6,7, 4,5,6,7, 12,13,14,15, 12,13,14,15 };
128
+ static Packet16uc p16uc_HALF64_0_16 = vec_sld(vec_splat((Packet16uc) vec_abs(p4i_MINUS16), 0), (Packet16uc)p4i_ZERO, 8); //{ 0,0,0,0, 0,0,0,0, 16,16,16,16, 16,16,16,16};
129
+ #endif // _BIG_ENDIAN
130
+
131
+ static Packet16uc p16uc_PSET64_HI = (Packet16uc) vec_mergeh((Packet4ui)p16uc_PSET32_WODD, (Packet4ui)p16uc_PSET32_WEVEN); //{ 0,1,2,3, 4,5,6,7, 0,1,2,3, 4,5,6,7 };
132
+ static Packet16uc p16uc_PSET64_LO = (Packet16uc) vec_mergel((Packet4ui)p16uc_PSET32_WODD, (Packet4ui)p16uc_PSET32_WEVEN); //{ 8,9,10,11, 12,13,14,15, 8,9,10,11, 12,13,14,15 };
133
+ static Packet16uc p16uc_TRANSPOSE64_HI = p16uc_PSET64_HI + p16uc_HALF64_0_16; //{ 0,1,2,3, 4,5,6,7, 16,17,18,19, 20,21,22,23};
134
+ static Packet16uc p16uc_TRANSPOSE64_LO = p16uc_PSET64_LO + p16uc_HALF64_0_16; //{ 8,9,10,11, 12,13,14,15, 24,25,26,27, 28,29,30,31};
135
+
136
+ static Packet16uc p16uc_COMPLEX32_REV = vec_sld(p16uc_REVERSE32, p16uc_REVERSE32, 8); //{ 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11 };
137
+
138
+ #ifdef _BIG_ENDIAN
139
+ static Packet16uc p16uc_COMPLEX32_REV2 = vec_sld(p16uc_FORWARD, p16uc_FORWARD, 8); //{ 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };
140
+ #else
141
+ static Packet16uc p16uc_COMPLEX32_REV2 = vec_sld(p16uc_PSET64_HI, p16uc_PSET64_LO, 8); //{ 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };
142
+ #endif // _BIG_ENDIAN
143
+
144
+ #if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC
145
+ #define EIGEN_PPC_PREFETCH(ADDR) __builtin_prefetch(ADDR);
146
+ #else
147
+ #define EIGEN_PPC_PREFETCH(ADDR) asm( " dcbt [%[addr]]\n" :: [addr] "r" (ADDR) : "cc" );
148
+ #endif
149
+
150
+ template <>
151
+ struct packet_traits<float> : default_packet_traits {
152
+ typedef Packet4f type;
153
+ typedef Packet4f half;
154
+ enum {
155
+ Vectorizable = 1,
156
+ AlignedOnScalar = 1,
157
+ size = 4,
158
+ HasHalfPacket = 1,
159
+
160
+ HasAdd = 1,
161
+ HasSub = 1,
162
+ HasMul = 1,
163
+ HasDiv = 1,
164
+ HasMin = 1,
165
+ HasMax = 1,
166
+ HasAbs = 1,
167
+ HasSin = EIGEN_FAST_MATH,
168
+ HasCos = EIGEN_FAST_MATH,
169
+ HasLog = 1,
170
+ HasExp = 1,
171
+ #ifdef EIGEN_VECTORIZE_VSX
172
+ HasSqrt = 1,
173
+ #if !EIGEN_COMP_CLANG
174
+ HasRsqrt = 1,
175
+ #else
176
+ HasRsqrt = 0,
177
+ #endif
178
+ HasTanh = EIGEN_FAST_MATH,
179
+ HasErf = EIGEN_FAST_MATH,
180
+ HasRint = 1,
181
+ #else
182
+ HasSqrt = 0,
183
+ HasRsqrt = 0,
184
+ HasTanh = EIGEN_FAST_MATH,
185
+ HasErf = EIGEN_FAST_MATH,
186
+ #endif
187
+ HasRound = 1,
188
+ HasFloor = 1,
189
+ HasCeil = 1,
190
+ HasNegate = 1,
191
+ HasBlend = 1
192
+ };
193
+ };
194
+ template <>
195
+ struct packet_traits<bfloat16> : default_packet_traits {
196
+ typedef Packet8bf type;
197
+ typedef Packet8bf half;
198
+ enum {
199
+ Vectorizable = 1,
200
+ AlignedOnScalar = 1,
201
+ size = 8,
202
+ HasHalfPacket = 0,
203
+
204
+ HasAdd = 1,
205
+ HasSub = 1,
206
+ HasMul = 1,
207
+ HasDiv = 1,
208
+ HasMin = 1,
209
+ HasMax = 1,
210
+ HasAbs = 1,
211
+ HasSin = EIGEN_FAST_MATH,
212
+ HasCos = EIGEN_FAST_MATH,
213
+ HasLog = 1,
214
+ HasExp = 1,
215
+ #ifdef EIGEN_VECTORIZE_VSX
216
+ HasSqrt = 1,
217
+ #if !EIGEN_COMP_CLANG
218
+ HasRsqrt = 1,
219
+ #else
220
+ HasRsqrt = 0,
221
+ #endif
222
+ HasRint = 1,
223
+ #else
224
+ HasSqrt = 0,
225
+ HasRsqrt = 0,
226
+ HasRint = 0,
227
+ #endif
228
+ HasTanh = 0,
229
+ HasErf = 0,
230
+ HasRound = 1,
231
+ HasFloor = 1,
232
+ HasCeil = 1,
233
+ HasNegate = 1,
234
+ HasBlend = 1
235
+ };
236
+ };
237
+
238
+ template <>
239
+ struct packet_traits<int> : default_packet_traits {
240
+ typedef Packet4i type;
241
+ typedef Packet4i half;
242
+ enum {
243
+ Vectorizable = 1,
244
+ AlignedOnScalar = 1,
245
+ size = 4,
246
+ HasHalfPacket = 0,
247
+
248
+ HasAdd = 1,
249
+ HasSub = 1,
250
+ HasShift = 1,
251
+ HasMul = 1,
252
+ HasDiv = 0,
253
+ HasBlend = 1
254
+ };
255
+ };
256
+
257
+ template <>
258
+ struct packet_traits<short int> : default_packet_traits {
259
+ typedef Packet8s type;
260
+ typedef Packet8s half;
261
+ enum {
262
+ Vectorizable = 1,
263
+ AlignedOnScalar = 1,
264
+ size = 8,
265
+ HasHalfPacket = 0,
266
+
267
+ HasAdd = 1,
268
+ HasSub = 1,
269
+ HasMul = 1,
270
+ HasDiv = 0,
271
+ HasBlend = 1
272
+ };
273
+ };
274
+
275
+ template <>
276
+ struct packet_traits<unsigned short int> : default_packet_traits {
277
+ typedef Packet8us type;
278
+ typedef Packet8us half;
279
+ enum {
280
+ Vectorizable = 1,
281
+ AlignedOnScalar = 1,
282
+ size = 8,
283
+ HasHalfPacket = 0,
284
+
285
+ HasAdd = 1,
286
+ HasSub = 1,
287
+ HasMul = 1,
288
+ HasDiv = 0,
289
+ HasBlend = 1
290
+ };
291
+ };
292
+
293
+ template <>
294
+ struct packet_traits<signed char> : default_packet_traits {
295
+ typedef Packet16c type;
296
+ typedef Packet16c half;
297
+ enum {
298
+ Vectorizable = 1,
299
+ AlignedOnScalar = 1,
300
+ size = 16,
301
+ HasHalfPacket = 0,
302
+
303
+ HasAdd = 1,
304
+ HasSub = 1,
305
+ HasMul = 1,
306
+ HasDiv = 0,
307
+ HasBlend = 1
308
+ };
309
+ };
310
+
311
+ template <>
312
+ struct packet_traits<unsigned char> : default_packet_traits {
313
+ typedef Packet16uc type;
314
+ typedef Packet16uc half;
315
+ enum {
316
+ Vectorizable = 1,
317
+ AlignedOnScalar = 1,
318
+ size = 16,
319
+ HasHalfPacket = 0,
320
+
321
+ HasAdd = 1,
322
+ HasSub = 1,
323
+ HasMul = 1,
324
+ HasDiv = 0,
325
+ HasBlend = 1
326
+ };
327
+ };
328
+
329
+ template<> struct unpacket_traits<Packet4f>
330
+ {
331
+ typedef float type;
332
+ typedef Packet4f half;
333
+ typedef Packet4i integer_packet;
334
+ enum {size=4, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false};
335
+ };
336
+ template<> struct unpacket_traits<Packet4i>
337
+ {
338
+ typedef int type;
339
+ typedef Packet4i half;
340
+ enum {size=4, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false};
341
+ };
342
+ template<> struct unpacket_traits<Packet8s>
343
+ {
344
+ typedef short int type;
345
+ typedef Packet8s half;
346
+ enum {size=8, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false};
347
+ };
348
+ template<> struct unpacket_traits<Packet8us>
349
+ {
350
+ typedef unsigned short int type;
351
+ typedef Packet8us half;
352
+ enum {size=8, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false};
353
+ };
354
+
355
+ template<> struct unpacket_traits<Packet16c>
356
+ {
357
+ typedef signed char type;
358
+ typedef Packet16c half;
359
+ enum {size=16, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false};
360
+ };
361
+ template<> struct unpacket_traits<Packet16uc>
362
+ {
363
+ typedef unsigned char type;
364
+ typedef Packet16uc half;
365
+ enum {size=16, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false};
366
+ };
367
+
368
+ template<> struct unpacket_traits<Packet8bf>
369
+ {
370
+ typedef bfloat16 type;
371
+ typedef Packet8bf half;
372
+ enum {size=8, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false};
373
+ };
374
+ inline std::ostream & operator <<(std::ostream & s, const Packet16c & v)
375
+ {
376
+ union {
377
+ Packet16c v;
378
+ signed char n[16];
379
+ } vt;
380
+ vt.v = v;
381
+ for (int i=0; i< 16; i++)
382
+ s << vt.n[i] << ", ";
383
+ return s;
384
+ }
385
+
386
+ inline std::ostream & operator <<(std::ostream & s, const Packet16uc & v)
387
+ {
388
+ union {
389
+ Packet16uc v;
390
+ unsigned char n[16];
391
+ } vt;
392
+ vt.v = v;
393
+ for (int i=0; i< 16; i++)
394
+ s << vt.n[i] << ", ";
395
+ return s;
396
+ }
397
+
398
+ inline std::ostream & operator <<(std::ostream & s, const Packet4f & v)
399
+ {
400
+ union {
401
+ Packet4f v;
402
+ float n[4];
403
+ } vt;
404
+ vt.v = v;
405
+ s << vt.n[0] << ", " << vt.n[1] << ", " << vt.n[2] << ", " << vt.n[3];
406
+ return s;
407
+ }
408
+
409
+ inline std::ostream & operator <<(std::ostream & s, const Packet4i & v)
410
+ {
411
+ union {
412
+ Packet4i v;
413
+ int n[4];
414
+ } vt;
415
+ vt.v = v;
416
+ s << vt.n[0] << ", " << vt.n[1] << ", " << vt.n[2] << ", " << vt.n[3];
417
+ return s;
418
+ }
419
+
420
+ inline std::ostream & operator <<(std::ostream & s, const Packet4ui & v)
421
+ {
422
+ union {
423
+ Packet4ui v;
424
+ unsigned int n[4];
425
+ } vt;
426
+ vt.v = v;
427
+ s << vt.n[0] << ", " << vt.n[1] << ", " << vt.n[2] << ", " << vt.n[3];
428
+ return s;
429
+ }
430
+
431
+ template <typename Packet>
432
+ EIGEN_STRONG_INLINE Packet pload_common(const __UNPACK_TYPE__(Packet)* from)
433
+ {
434
+ // some versions of GCC throw "unused-but-set-parameter".
435
+ // ignoring these warnings for now.
436
+ EIGEN_UNUSED_VARIABLE(from);
437
+ EIGEN_DEBUG_ALIGNED_LOAD
438
+ #ifdef EIGEN_VECTORIZE_VSX
439
+ return vec_xl(0, const_cast<__UNPACK_TYPE__(Packet)*>(from));
440
+ #else
441
+ return vec_ld(0, from);
442
+ #endif
443
+ }
444
+
445
+ // Need to define them first or we get specialization after instantiation errors
446
+ template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from)
447
+ {
448
+ return pload_common<Packet4f>(from);
449
+ }
450
+
451
+ template<> EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(const int* from)
452
+ {
453
+ return pload_common<Packet4i>(from);
454
+ }
455
+
456
+ template<> EIGEN_STRONG_INLINE Packet8s pload<Packet8s>(const short int* from)
457
+ {
458
+ return pload_common<Packet8s>(from);
459
+ }
460
+
461
+ template<> EIGEN_STRONG_INLINE Packet8us pload<Packet8us>(const unsigned short int* from)
462
+ {
463
+ return pload_common<Packet8us>(from);
464
+ }
465
+
466
+ template<> EIGEN_STRONG_INLINE Packet16c pload<Packet16c>(const signed char* from)
467
+ {
468
+ return pload_common<Packet16c>(from);
469
+ }
470
+
471
+ template<> EIGEN_STRONG_INLINE Packet16uc pload<Packet16uc>(const unsigned char* from)
472
+ {
473
+ return pload_common<Packet16uc>(from);
474
+ }
475
+
476
+ template<> EIGEN_STRONG_INLINE Packet8bf pload<Packet8bf>(const bfloat16* from)
477
+ {
478
+ return pload_common<Packet8us>(reinterpret_cast<const unsigned short int*>(from));
479
+ }
480
+
481
+ template <typename Packet>
482
+ EIGEN_STRONG_INLINE void pstore_common(__UNPACK_TYPE__(Packet)* to, const Packet& from){
483
+ // some versions of GCC throw "unused-but-set-parameter" (float *to).
484
+ // ignoring these warnings for now.
485
+ EIGEN_UNUSED_VARIABLE(to);
486
+ EIGEN_DEBUG_ALIGNED_STORE
487
+ #ifdef EIGEN_VECTORIZE_VSX
488
+ vec_xst(from, 0, to);
489
+ #else
490
+ vec_st(from, 0, to);
491
+ #endif
492
+ }
493
+
494
+ template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from)
495
+ {
496
+ pstore_common<Packet4f>(to, from);
497
+ }
498
+
499
+ template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from)
500
+ {
501
+ pstore_common<Packet4i>(to, from);
502
+ }
503
+
504
+ template<> EIGEN_STRONG_INLINE void pstore<short int>(short int* to, const Packet8s& from)
505
+ {
506
+ pstore_common<Packet8s>(to, from);
507
+ }
508
+
509
+ template<> EIGEN_STRONG_INLINE void pstore<unsigned short int>(unsigned short int* to, const Packet8us& from)
510
+ {
511
+ pstore_common<Packet8us>(to, from);
512
+ }
513
+
514
+ template<> EIGEN_STRONG_INLINE void pstore<bfloat16>(bfloat16* to, const Packet8bf& from)
515
+ {
516
+ pstore_common<Packet8us>(reinterpret_cast<unsigned short int*>(to), from);
517
+ }
518
+
519
+ template<> EIGEN_STRONG_INLINE void pstore<signed char>(signed char* to, const Packet16c& from)
520
+ {
521
+ pstore_common<Packet16c>(to, from);
522
+ }
523
+
524
+ template<> EIGEN_STRONG_INLINE void pstore<unsigned char>(unsigned char* to, const Packet16uc& from)
525
+ {
526
+ pstore_common<Packet16uc>(to, from);
527
+ }
528
+
529
+ template<typename Packet>
530
+ EIGEN_STRONG_INLINE Packet pset1_size4(const __UNPACK_TYPE__(Packet)& from)
531
+ {
532
+ Packet v = {from, from, from, from};
533
+ return v;
534
+ }
535
+
536
+ template<typename Packet>
537
+ EIGEN_STRONG_INLINE Packet pset1_size8(const __UNPACK_TYPE__(Packet)& from)
538
+ {
539
+ Packet v = {from, from, from, from, from, from, from, from};
540
+ return v;
541
+ }
542
+
543
+ template<typename Packet>
544
+ EIGEN_STRONG_INLINE Packet pset1_size16(const __UNPACK_TYPE__(Packet)& from)
545
+ {
546
+ Packet v = {from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from};
547
+ return v;
548
+ }
549
+
550
+ template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) {
551
+ return pset1_size4<Packet4f>(from);
552
+ }
553
+
554
+ template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) {
555
+ return pset1_size4<Packet4i>(from);
556
+ }
557
+
558
+ template<> EIGEN_STRONG_INLINE Packet8s pset1<Packet8s>(const short int& from) {
559
+ return pset1_size8<Packet8s>(from);
560
+ }
561
+
562
+ template<> EIGEN_STRONG_INLINE Packet8us pset1<Packet8us>(const unsigned short int& from) {
563
+ return pset1_size8<Packet8us>(from);
564
+ }
565
+
566
+ template<> EIGEN_STRONG_INLINE Packet16c pset1<Packet16c>(const signed char& from) {
567
+ return pset1_size16<Packet16c>(from);
568
+ }
569
+
570
+ template<> EIGEN_STRONG_INLINE Packet16uc pset1<Packet16uc>(const unsigned char& from) {
571
+ return pset1_size16<Packet16uc>(from);
572
+ }
573
+
574
+ template<> EIGEN_STRONG_INLINE Packet4f pset1frombits<Packet4f>(unsigned int from) {
575
+ return reinterpret_cast<Packet4f>(pset1<Packet4i>(from));
576
+ }
577
+
578
+ template<> EIGEN_STRONG_INLINE Packet8bf pset1<Packet8bf>(const bfloat16& from) {
579
+ return pset1_size8<Packet8us>(reinterpret_cast<const unsigned short int&>(from));
580
+ }
581
+
582
+ template<typename Packet> EIGEN_STRONG_INLINE void
583
+ pbroadcast4_common(const __UNPACK_TYPE__(Packet) *a,
584
+ Packet& a0, Packet& a1, Packet& a2, Packet& a3)
585
+ {
586
+ a3 = pload<Packet>(a);
587
+ a0 = vec_splat(a3, 0);
588
+ a1 = vec_splat(a3, 1);
589
+ a2 = vec_splat(a3, 2);
590
+ a3 = vec_splat(a3, 3);
591
+ }
592
+
593
+ template<> EIGEN_STRONG_INLINE void
594
+ pbroadcast4<Packet4f>(const float *a,
595
+ Packet4f& a0, Packet4f& a1, Packet4f& a2, Packet4f& a3)
596
+ {
597
+ pbroadcast4_common<Packet4f>(a, a0, a1, a2, a3);
598
+ }
599
+ template<> EIGEN_STRONG_INLINE void
600
+ pbroadcast4<Packet4i>(const int *a,
601
+ Packet4i& a0, Packet4i& a1, Packet4i& a2, Packet4i& a3)
602
+ {
603
+ pbroadcast4_common<Packet4i>(a, a0, a1, a2, a3);
604
+ }
605
+
606
+ template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pgather_common(const __UNPACK_TYPE__(Packet)* from, Index stride)
607
+ {
608
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) a[4];
609
+ a[0] = from[0*stride];
610
+ a[1] = from[1*stride];
611
+ a[2] = from[2*stride];
612
+ a[3] = from[3*stride];
613
+ return pload<Packet>(a);
614
+ }
615
+
616
+ template<> EIGEN_DEVICE_FUNC inline Packet4f pgather<float, Packet4f>(const float* from, Index stride)
617
+ {
618
+ return pgather_common<Packet4f>(from, stride);
619
+ }
620
+
621
+ template<> EIGEN_DEVICE_FUNC inline Packet4i pgather<int, Packet4i>(const int* from, Index stride)
622
+ {
623
+ return pgather_common<Packet4i>(from, stride);
624
+ }
625
+
626
+ template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pgather_size8(const __UNPACK_TYPE__(Packet)* from, Index stride)
627
+ {
628
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) a[8];
629
+ a[0] = from[0*stride];
630
+ a[1] = from[1*stride];
631
+ a[2] = from[2*stride];
632
+ a[3] = from[3*stride];
633
+ a[4] = from[4*stride];
634
+ a[5] = from[5*stride];
635
+ a[6] = from[6*stride];
636
+ a[7] = from[7*stride];
637
+ return pload<Packet>(a);
638
+ }
639
+
640
+ template<> EIGEN_DEVICE_FUNC inline Packet8s pgather<short int, Packet8s>(const short int* from, Index stride)
641
+ {
642
+ return pgather_size8<Packet8s>(from, stride);
643
+ }
644
+
645
+ template<> EIGEN_DEVICE_FUNC inline Packet8us pgather<unsigned short int, Packet8us>(const unsigned short int* from, Index stride)
646
+ {
647
+ return pgather_size8<Packet8us>(from, stride);
648
+ }
649
+
650
+ template<> EIGEN_DEVICE_FUNC inline Packet8bf pgather<bfloat16, Packet8bf>(const bfloat16* from, Index stride)
651
+ {
652
+ return pgather_size8<Packet8bf>(from, stride);
653
+ }
654
+
655
+ template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pgather_size16(const __UNPACK_TYPE__(Packet)* from, Index stride)
656
+ {
657
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) a[16];
658
+ a[0] = from[0*stride];
659
+ a[1] = from[1*stride];
660
+ a[2] = from[2*stride];
661
+ a[3] = from[3*stride];
662
+ a[4] = from[4*stride];
663
+ a[5] = from[5*stride];
664
+ a[6] = from[6*stride];
665
+ a[7] = from[7*stride];
666
+ a[8] = from[8*stride];
667
+ a[9] = from[9*stride];
668
+ a[10] = from[10*stride];
669
+ a[11] = from[11*stride];
670
+ a[12] = from[12*stride];
671
+ a[13] = from[13*stride];
672
+ a[14] = from[14*stride];
673
+ a[15] = from[15*stride];
674
+ return pload<Packet>(a);
675
+ }
676
+
677
+
678
+ template<> EIGEN_DEVICE_FUNC inline Packet16c pgather<signed char, Packet16c>(const signed char* from, Index stride)
679
+ {
680
+ return pgather_size16<Packet16c>(from, stride);
681
+ }
682
+
683
+ template<> EIGEN_DEVICE_FUNC inline Packet16uc pgather<unsigned char, Packet16uc>(const unsigned char* from, Index stride)
684
+ {
685
+ return pgather_size16<Packet16uc>(from, stride);
686
+ }
687
+
688
+ template<typename Packet> EIGEN_DEVICE_FUNC inline void pscatter_size4(__UNPACK_TYPE__(Packet)* to, const Packet& from, Index stride)
689
+ {
690
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) a[4];
691
+ pstore<__UNPACK_TYPE__(Packet)>(a, from);
692
+ to[0*stride] = a[0];
693
+ to[1*stride] = a[1];
694
+ to[2*stride] = a[2];
695
+ to[3*stride] = a[3];
696
+ }
697
+
698
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<float, Packet4f>(float* to, const Packet4f& from, Index stride)
699
+ {
700
+ pscatter_size4<Packet4f>(to, from, stride);
701
+ }
702
+
703
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<int, Packet4i>(int* to, const Packet4i& from, Index stride)
704
+ {
705
+ pscatter_size4<Packet4i>(to, from, stride);
706
+ }
707
+
708
+ template<typename Packet> EIGEN_DEVICE_FUNC inline void pscatter_size8(__UNPACK_TYPE__(Packet)* to, const Packet& from, Index stride)
709
+ {
710
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) a[8];
711
+ pstore<__UNPACK_TYPE__(Packet)>(a, from);
712
+ to[0*stride] = a[0];
713
+ to[1*stride] = a[1];
714
+ to[2*stride] = a[2];
715
+ to[3*stride] = a[3];
716
+ to[4*stride] = a[4];
717
+ to[5*stride] = a[5];
718
+ to[6*stride] = a[6];
719
+ to[7*stride] = a[7];
720
+ }
721
+
722
+
723
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<short int, Packet8s>(short int* to, const Packet8s& from, Index stride)
724
+ {
725
+ pscatter_size8<Packet8s>(to, from, stride);
726
+ }
727
+
728
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<unsigned short int, Packet8us>(unsigned short int* to, const Packet8us& from, Index stride)
729
+ {
730
+ pscatter_size8<Packet8us>(to, from, stride);
731
+ }
732
+
733
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<bfloat16, Packet8bf>(bfloat16* to, const Packet8bf& from, Index stride)
734
+ {
735
+ pscatter_size8<Packet8bf>(to, from, stride);
736
+ }
737
+
738
+ template<typename Packet> EIGEN_DEVICE_FUNC inline void pscatter_size16(__UNPACK_TYPE__(Packet)* to, const Packet& from, Index stride)
739
+ {
740
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) a[16];
741
+ pstore<__UNPACK_TYPE__(Packet)>(a, from);
742
+ to[0*stride] = a[0];
743
+ to[1*stride] = a[1];
744
+ to[2*stride] = a[2];
745
+ to[3*stride] = a[3];
746
+ to[4*stride] = a[4];
747
+ to[5*stride] = a[5];
748
+ to[6*stride] = a[6];
749
+ to[7*stride] = a[7];
750
+ to[8*stride] = a[8];
751
+ to[9*stride] = a[9];
752
+ to[10*stride] = a[10];
753
+ to[11*stride] = a[11];
754
+ to[12*stride] = a[12];
755
+ to[13*stride] = a[13];
756
+ to[14*stride] = a[14];
757
+ to[15*stride] = a[15];
758
+ }
759
+
760
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<signed char, Packet16c>(signed char* to, const Packet16c& from, Index stride)
761
+ {
762
+ pscatter_size16<Packet16c>(to, from, stride);
763
+ }
764
+
765
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<unsigned char, Packet16uc>(unsigned char* to, const Packet16uc& from, Index stride)
766
+ {
767
+ pscatter_size16<Packet16uc>(to, from, stride);
768
+ }
769
+
770
+ template<> EIGEN_STRONG_INLINE Packet4f plset<Packet4f>(const float& a) { return pset1<Packet4f>(a) + p4f_COUNTDOWN; }
771
+ template<> EIGEN_STRONG_INLINE Packet4i plset<Packet4i>(const int& a) { return pset1<Packet4i>(a) + p4i_COUNTDOWN; }
772
+ template<> EIGEN_STRONG_INLINE Packet8s plset<Packet8s>(const short int& a) { return pset1<Packet8s>(a) + p8s_COUNTDOWN; }
773
+ template<> EIGEN_STRONG_INLINE Packet8us plset<Packet8us>(const unsigned short int& a) { return pset1<Packet8us>(a) + p8us_COUNTDOWN; }
774
+ template<> EIGEN_STRONG_INLINE Packet16c plset<Packet16c>(const signed char& a) { return pset1<Packet16c>(a) + p16c_COUNTDOWN; }
775
+ template<> EIGEN_STRONG_INLINE Packet16uc plset<Packet16uc>(const unsigned char& a) { return pset1<Packet16uc>(a) + p16uc_COUNTDOWN; }
776
+
777
+ template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f> (const Packet4f& a, const Packet4f& b) { return a + b; }
778
+ template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i> (const Packet4i& a, const Packet4i& b) { return a + b; }
779
+ template<> EIGEN_STRONG_INLINE Packet4ui padd<Packet4ui> (const Packet4ui& a, const Packet4ui& b) { return a + b; }
780
+ template<> EIGEN_STRONG_INLINE Packet8s padd<Packet8s> (const Packet8s& a, const Packet8s& b) { return a + b; }
781
+ template<> EIGEN_STRONG_INLINE Packet8us padd<Packet8us> (const Packet8us& a, const Packet8us& b) { return a + b; }
782
+ template<> EIGEN_STRONG_INLINE Packet16c padd<Packet16c> (const Packet16c& a, const Packet16c& b) { return a + b; }
783
+ template<> EIGEN_STRONG_INLINE Packet16uc padd<Packet16uc>(const Packet16uc& a, const Packet16uc& b) { return a + b; }
784
+
785
+ template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f> (const Packet4f& a, const Packet4f& b) { return a - b; }
786
+ template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i> (const Packet4i& a, const Packet4i& b) { return a - b; }
787
+ template<> EIGEN_STRONG_INLINE Packet8s psub<Packet8s> (const Packet8s& a, const Packet8s& b) { return a - b; }
788
+ template<> EIGEN_STRONG_INLINE Packet8us psub<Packet8us> (const Packet8us& a, const Packet8us& b) { return a - b; }
789
+ template<> EIGEN_STRONG_INLINE Packet16c psub<Packet16c> (const Packet16c& a, const Packet16c& b) { return a - b; }
790
+ template<> EIGEN_STRONG_INLINE Packet16uc psub<Packet16uc>(const Packet16uc& a, const Packet16uc& b) { return a - b; }
791
+
792
+ template<> EIGEN_STRONG_INLINE Packet4f pnegate(const Packet4f& a)
793
+ {
794
+ #ifdef __POWER8_VECTOR__
795
+ return vec_neg(a);
796
+ #else
797
+ return vec_xor(a, p4f_MZERO);
798
+ #endif
799
+ }
800
+ template<> EIGEN_STRONG_INLINE Packet4i pnegate(const Packet4i& a)
801
+ {
802
+ #ifdef __POWER8_VECTOR__
803
+ return vec_neg(a);
804
+ #else
805
+ return p4i_ZERO - a;
806
+ #endif
807
+ }
808
+
809
+ template<> EIGEN_STRONG_INLINE Packet4f pconj(const Packet4f& a) { return a; }
810
+ template<> EIGEN_STRONG_INLINE Packet4i pconj(const Packet4i& a) { return a; }
811
+
812
+ template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f> (const Packet4f& a, const Packet4f& b) { return vec_madd(a,b, p4f_MZERO); }
813
+ template<> EIGEN_STRONG_INLINE Packet4i pmul<Packet4i> (const Packet4i& a, const Packet4i& b) { return a * b; }
814
+ template<> EIGEN_STRONG_INLINE Packet8s pmul<Packet8s> (const Packet8s& a, const Packet8s& b) { return vec_mul(a,b); }
815
+ template<> EIGEN_STRONG_INLINE Packet8us pmul<Packet8us> (const Packet8us& a, const Packet8us& b) { return vec_mul(a,b); }
816
+ template<> EIGEN_STRONG_INLINE Packet16c pmul<Packet16c> (const Packet16c& a, const Packet16c& b) { return vec_mul(a,b); }
817
+ template<> EIGEN_STRONG_INLINE Packet16uc pmul<Packet16uc>(const Packet16uc& a, const Packet16uc& b) { return vec_mul(a,b); }
818
+
819
+
820
+ template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b)
821
+ {
822
+ #ifndef EIGEN_VECTORIZE_VSX // VSX actually provides a div instruction
823
+ Packet4f t, y_0, y_1;
824
+
825
+ // Altivec does not offer a divide instruction, we have to do a reciprocal approximation
826
+ y_0 = vec_re(b);
827
+
828
+ // Do one Newton-Raphson iteration to get the needed accuracy
829
+ t = vec_nmsub(y_0, b, p4f_ONE);
830
+ y_1 = vec_madd(y_0, t, y_0);
831
+
832
+ return vec_madd(a, y_1, p4f_MZERO);
833
+ #else
834
+ return vec_div(a, b);
835
+ #endif
836
+ }
837
+
838
+ template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(const Packet4i& /*a*/, const Packet4i& /*b*/)
839
+ { eigen_assert(false && "packet integer division are not supported by AltiVec");
840
+ return pset1<Packet4i>(0);
841
+ }
842
+
843
+ // for some weird raisons, it has to be overloaded for packet of integers
844
+ template<> EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vec_madd(a,b,c); }
845
+ template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return a*b + c; }
846
+ template<> EIGEN_STRONG_INLINE Packet8s pmadd(const Packet8s& a, const Packet8s& b, const Packet8s& c) { return vec_madd(a,b,c); }
847
+ template<> EIGEN_STRONG_INLINE Packet8us pmadd(const Packet8us& a, const Packet8us& b, const Packet8us& c) { return vec_madd(a,b,c); }
848
+
849
+ template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b)
850
+ {
851
+ #ifdef EIGEN_VECTORIZE_VSX
852
+ // NOTE: about 10% slower than vec_min, but consistent with std::min and SSE regarding NaN
853
+ Packet4f ret;
854
+ __asm__ ("xvcmpgesp %x0,%x1,%x2\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));
855
+ return ret;
856
+ #else
857
+ return vec_min(a, b);
858
+ #endif
859
+ }
860
+ template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_min(a, b); }
861
+ template<> EIGEN_STRONG_INLINE Packet8s pmin<Packet8s>(const Packet8s& a, const Packet8s& b) { return vec_min(a, b); }
862
+ template<> EIGEN_STRONG_INLINE Packet8us pmin<Packet8us>(const Packet8us& a, const Packet8us& b) { return vec_min(a, b); }
863
+ template<> EIGEN_STRONG_INLINE Packet16c pmin<Packet16c>(const Packet16c& a, const Packet16c& b) { return vec_min(a, b); }
864
+ template<> EIGEN_STRONG_INLINE Packet16uc pmin<Packet16uc>(const Packet16uc& a, const Packet16uc& b) { return vec_min(a, b); }
865
+
866
+
867
+ template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b)
868
+ {
869
+ #ifdef EIGEN_VECTORIZE_VSX
870
+ // NOTE: about 10% slower than vec_max, but consistent with std::max and SSE regarding NaN
871
+ Packet4f ret;
872
+ __asm__ ("xvcmpgtsp %x0,%x2,%x1\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));
873
+ return ret;
874
+ #else
875
+ return vec_max(a, b);
876
+ #endif
877
+ }
878
+ template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_max(a, b); }
879
+ template<> EIGEN_STRONG_INLINE Packet8s pmax<Packet8s>(const Packet8s& a, const Packet8s& b) { return vec_max(a, b); }
880
+ template<> EIGEN_STRONG_INLINE Packet8us pmax<Packet8us>(const Packet8us& a, const Packet8us& b) { return vec_max(a, b); }
881
+ template<> EIGEN_STRONG_INLINE Packet16c pmax<Packet16c>(const Packet16c& a, const Packet16c& b) { return vec_max(a, b); }
882
+ template<> EIGEN_STRONG_INLINE Packet16uc pmax<Packet16uc>(const Packet16uc& a, const Packet16uc& b) { return vec_max(a, b); }
883
+
884
+ template<> EIGEN_STRONG_INLINE Packet4f pcmp_le(const Packet4f& a, const Packet4f& b) { return reinterpret_cast<Packet4f>(vec_cmple(a,b)); }
885
+ // To fix bug with vec_cmplt on older versions
886
+ #if defined(__POWER8_VECTOR__) || EIGEN_COMP_LLVM
887
+ template<> EIGEN_STRONG_INLINE Packet4f pcmp_lt(const Packet4f& a, const Packet4f& b) { return reinterpret_cast<Packet4f>(vec_cmplt(a,b)); }
888
+ #endif
889
+ template<> EIGEN_STRONG_INLINE Packet4f pcmp_eq(const Packet4f& a, const Packet4f& b) { return reinterpret_cast<Packet4f>(vec_cmpeq(a,b)); }
890
+ template<> EIGEN_STRONG_INLINE Packet4f pcmp_lt_or_nan(const Packet4f& a, const Packet4f& b) {
891
+ Packet4f c = reinterpret_cast<Packet4f>(vec_cmpge(a,b));
892
+ return vec_nor(c,c);
893
+ }
894
+
895
+ #ifdef __VSX__
896
+ template<> EIGEN_STRONG_INLINE Packet4i pcmp_le(const Packet4i& a, const Packet4i& b) { return reinterpret_cast<Packet4i>(vec_cmple(a,b)); }
897
+ #endif
898
+ template<> EIGEN_STRONG_INLINE Packet4i pcmp_lt(const Packet4i& a, const Packet4i& b) { return reinterpret_cast<Packet4i>(vec_cmplt(a,b)); }
899
+ template<> EIGEN_STRONG_INLINE Packet4i pcmp_eq(const Packet4i& a, const Packet4i& b) { return reinterpret_cast<Packet4i>(vec_cmpeq(a,b)); }
900
+ #ifdef __VSX__
901
+ template<> EIGEN_STRONG_INLINE Packet8s pcmp_le(const Packet8s& a, const Packet8s& b) { return reinterpret_cast<Packet8s>(vec_cmple(a,b)); }
902
+ #endif
903
+ template<> EIGEN_STRONG_INLINE Packet8s pcmp_lt(const Packet8s& a, const Packet8s& b) { return reinterpret_cast<Packet8s>(vec_cmplt(a,b)); }
904
+ template<> EIGEN_STRONG_INLINE Packet8s pcmp_eq(const Packet8s& a, const Packet8s& b) { return reinterpret_cast<Packet8s>(vec_cmpeq(a,b)); }
905
+ #ifdef __VSX__
906
+ template<> EIGEN_STRONG_INLINE Packet8us pcmp_le(const Packet8us& a, const Packet8us& b) { return reinterpret_cast<Packet8us>(vec_cmple(a,b)); }
907
+ #endif
908
+ template<> EIGEN_STRONG_INLINE Packet8us pcmp_lt(const Packet8us& a, const Packet8us& b) { return reinterpret_cast<Packet8us>(vec_cmplt(a,b)); }
909
+ template<> EIGEN_STRONG_INLINE Packet8us pcmp_eq(const Packet8us& a, const Packet8us& b) { return reinterpret_cast<Packet8us>(vec_cmpeq(a,b)); }
910
+ #ifdef __VSX__
911
+ template<> EIGEN_STRONG_INLINE Packet16c pcmp_le(const Packet16c& a, const Packet16c& b) { return reinterpret_cast<Packet16c>(vec_cmple(a,b)); }
912
+ #endif
913
+ template<> EIGEN_STRONG_INLINE Packet16c pcmp_lt(const Packet16c& a, const Packet16c& b) { return reinterpret_cast<Packet16c>(vec_cmplt(a,b)); }
914
+ template<> EIGEN_STRONG_INLINE Packet16c pcmp_eq(const Packet16c& a, const Packet16c& b) { return reinterpret_cast<Packet16c>(vec_cmpeq(a,b)); }
915
+ #ifdef __VSX__
916
+ template<> EIGEN_STRONG_INLINE Packet16uc pcmp_le(const Packet16uc& a, const Packet16uc& b) { return reinterpret_cast<Packet16uc>(vec_cmple(a,b)); }
917
+ #endif
918
+ template<> EIGEN_STRONG_INLINE Packet16uc pcmp_lt(const Packet16uc& a, const Packet16uc& b) { return reinterpret_cast<Packet16uc>(vec_cmplt(a,b)); }
919
+ template<> EIGEN_STRONG_INLINE Packet16uc pcmp_eq(const Packet16uc& a, const Packet16uc& b) { return reinterpret_cast<Packet16uc>(vec_cmpeq(a,b)); }
920
+
921
+ template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_and(a, b); }
922
+ template<> EIGEN_STRONG_INLINE Packet4i pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_and(a, b); }
923
+ template<> EIGEN_STRONG_INLINE Packet4ui pand<Packet4ui>(const Packet4ui& a, const Packet4ui& b) { return vec_and(a, b); }
924
+ template<> EIGEN_STRONG_INLINE Packet8us pand<Packet8us>(const Packet8us& a, const Packet8us& b) { return vec_and(a, b); }
925
+ template<> EIGEN_STRONG_INLINE Packet8bf pand<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
926
+ return pand<Packet8us>(a, b);
927
+ }
928
+
929
+
930
+ template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_or(a, b); }
931
+ template<> EIGEN_STRONG_INLINE Packet4i por<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_or(a, b); }
932
+ template<> EIGEN_STRONG_INLINE Packet8s por<Packet8s>(const Packet8s& a, const Packet8s& b) { return vec_or(a, b); }
933
+ template<> EIGEN_STRONG_INLINE Packet8us por<Packet8us>(const Packet8us& a, const Packet8us& b) { return vec_or(a, b); }
934
+ template<> EIGEN_STRONG_INLINE Packet8bf por<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
935
+ return por<Packet8us>(a, b);
936
+ }
937
+
938
+ template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_xor(a, b); }
939
+ template<> EIGEN_STRONG_INLINE Packet4i pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_xor(a, b); }
940
+ template<> EIGEN_STRONG_INLINE Packet8bf pxor<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
941
+ return pxor<Packet8us>(a, b);
942
+ }
943
+
944
+ template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_andc(a, b); }
945
+ template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_andc(a, b); }
946
+
947
+ template<> EIGEN_STRONG_INLINE Packet4f pselect(const Packet4f& mask, const Packet4f& a, const Packet4f& b) {
948
+ return vec_sel(b, a, reinterpret_cast<Packet4ui>(mask));
949
+ }
950
+
951
+ template<> EIGEN_STRONG_INLINE Packet4f pround<Packet4f>(const Packet4f& a)
952
+ {
953
+ Packet4f t = vec_add(reinterpret_cast<Packet4f>(vec_or(vec_and(reinterpret_cast<Packet4ui>(a), p4ui_SIGN), p4ui_PREV0DOT5)), a);
954
+ Packet4f res;
955
+
956
+ #ifdef EIGEN_VECTORIZE_VSX
957
+ __asm__("xvrspiz %x0, %x1\n\t"
958
+ : "=&wa" (res)
959
+ : "wa" (t));
960
+ #else
961
+ __asm__("vrfiz %0, %1\n\t"
962
+ : "=v" (res)
963
+ : "v" (t));
964
+ #endif
965
+
966
+ return res;
967
+ }
968
+ template<> EIGEN_STRONG_INLINE Packet4f pceil<Packet4f>(const Packet4f& a) { return vec_ceil(a); }
969
+ template<> EIGEN_STRONG_INLINE Packet4f pfloor<Packet4f>(const Packet4f& a) { return vec_floor(a); }
970
+ #ifdef __VSX__
971
+ template<> EIGEN_STRONG_INLINE Packet4f print<Packet4f>(const Packet4f& a)
972
+ {
973
+ Packet4f res;
974
+
975
+ __asm__("xvrspic %x0, %x1\n\t"
976
+ : "=&wa" (res)
977
+ : "wa" (a));
978
+
979
+ return res;
980
+ }
981
+ #endif
982
+
983
+ template<typename Packet> EIGEN_STRONG_INLINE Packet ploadu_common(const __UNPACK_TYPE__(Packet)* from)
984
+ {
985
+ EIGEN_DEBUG_UNALIGNED_LOAD
986
+ #ifdef EIGEN_VECTORIZE_VSX
987
+ return vec_xl(0, const_cast<__UNPACK_TYPE__(Packet)*>(from));
988
+ #else
989
+ Packet16uc mask = vec_lvsl(0, from); // create the permute mask
990
+ Packet16uc MSQ = vec_ld(0, (unsigned char *)from); // most significant quadword
991
+ Packet16uc LSQ = vec_ld(15, (unsigned char *)from); // least significant quadword
992
+ //TODO: Add static_cast here
993
+ return (Packet) vec_perm(MSQ, LSQ, mask); // align the data
994
+ #endif
995
+ }
996
+
997
+ template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from)
998
+ {
999
+ return ploadu_common<Packet4f>(from);
1000
+ }
1001
+ template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from)
1002
+ {
1003
+ return ploadu_common<Packet4i>(from);
1004
+ }
1005
+ template<> EIGEN_STRONG_INLINE Packet8s ploadu<Packet8s>(const short int* from)
1006
+ {
1007
+ return ploadu_common<Packet8s>(from);
1008
+ }
1009
+ template<> EIGEN_STRONG_INLINE Packet8us ploadu<Packet8us>(const unsigned short int* from)
1010
+ {
1011
+ return ploadu_common<Packet8us>(from);
1012
+ }
1013
+ template<> EIGEN_STRONG_INLINE Packet8bf ploadu<Packet8bf>(const bfloat16* from)
1014
+ {
1015
+ return ploadu_common<Packet8us>(reinterpret_cast<const unsigned short int*>(from));
1016
+ }
1017
+ template<> EIGEN_STRONG_INLINE Packet16c ploadu<Packet16c>(const signed char* from)
1018
+ {
1019
+ return ploadu_common<Packet16c>(from);
1020
+ }
1021
+ template<> EIGEN_STRONG_INLINE Packet16uc ploadu<Packet16uc>(const unsigned char* from)
1022
+ {
1023
+ return ploadu_common<Packet16uc>(from);
1024
+ }
1025
+
1026
+ template<typename Packet> EIGEN_STRONG_INLINE Packet ploaddup_common(const __UNPACK_TYPE__(Packet)* from)
1027
+ {
1028
+ Packet p;
1029
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet>(from);
1030
+ else p = ploadu<Packet>(from);
1031
+ return vec_perm(p, p, p16uc_DUPLICATE32_HI);
1032
+ }
1033
+ template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from)
1034
+ {
1035
+ return ploaddup_common<Packet4f>(from);
1036
+ }
1037
+ template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const int* from)
1038
+ {
1039
+ return ploaddup_common<Packet4i>(from);
1040
+ }
1041
+
1042
+ template<> EIGEN_STRONG_INLINE Packet8s ploaddup<Packet8s>(const short int* from)
1043
+ {
1044
+ Packet8s p;
1045
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet8s>(from);
1046
+ else p = ploadu<Packet8s>(from);
1047
+ return vec_perm(p, p, p16uc_DUPLICATE16_HI);
1048
+ }
1049
+
1050
+ template<> EIGEN_STRONG_INLINE Packet8us ploaddup<Packet8us>(const unsigned short int* from)
1051
+ {
1052
+ Packet8us p;
1053
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet8us>(from);
1054
+ else p = ploadu<Packet8us>(from);
1055
+ return vec_perm(p, p, p16uc_DUPLICATE16_HI);
1056
+ }
1057
+
1058
+ template<> EIGEN_STRONG_INLINE Packet8s ploadquad<Packet8s>(const short int* from)
1059
+ {
1060
+ Packet8s p;
1061
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet8s>(from);
1062
+ else p = ploadu<Packet8s>(from);
1063
+ return vec_perm(p, p, p16uc_QUADRUPLICATE16_HI);
1064
+ }
1065
+
1066
+ template<> EIGEN_STRONG_INLINE Packet8us ploadquad<Packet8us>(const unsigned short int* from)
1067
+ {
1068
+ Packet8us p;
1069
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet8us>(from);
1070
+ else p = ploadu<Packet8us>(from);
1071
+ return vec_perm(p, p, p16uc_QUADRUPLICATE16_HI);
1072
+ }
1073
+
1074
+ template<> EIGEN_STRONG_INLINE Packet8bf ploadquad<Packet8bf>(const bfloat16* from)
1075
+ {
1076
+ return ploadquad<Packet8us>(reinterpret_cast<const unsigned short int*>(from));
1077
+ }
1078
+
1079
+ template<> EIGEN_STRONG_INLINE Packet16c ploaddup<Packet16c>(const signed char* from)
1080
+ {
1081
+ Packet16c p;
1082
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet16c>(from);
1083
+ else p = ploadu<Packet16c>(from);
1084
+ return vec_perm(p, p, p16uc_DUPLICATE8_HI);
1085
+ }
1086
+
1087
+ template<> EIGEN_STRONG_INLINE Packet16uc ploaddup<Packet16uc>(const unsigned char* from)
1088
+ {
1089
+ Packet16uc p;
1090
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet16uc>(from);
1091
+ else p = ploadu<Packet16uc>(from);
1092
+ return vec_perm(p, p, p16uc_DUPLICATE8_HI);
1093
+ }
1094
+
1095
+ template<typename Packet> EIGEN_STRONG_INLINE void pstoreu_common(__UNPACK_TYPE__(Packet)* to, const Packet& from)
1096
+ {
1097
+ EIGEN_DEBUG_UNALIGNED_STORE
1098
+ #ifdef EIGEN_VECTORIZE_VSX
1099
+ vec_xst(from, 0, to);
1100
+ #else
1101
+ // Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
1102
+ // Warning: not thread safe!
1103
+ Packet16uc MSQ, LSQ, edges;
1104
+ Packet16uc edgeAlign, align;
1105
+
1106
+ MSQ = vec_ld(0, (unsigned char *)to); // most significant quadword
1107
+ LSQ = vec_ld(15, (unsigned char *)to); // least significant quadword
1108
+ edgeAlign = vec_lvsl(0, to); // permute map to extract edges
1109
+ edges=vec_perm(LSQ,MSQ,edgeAlign); // extract the edges
1110
+ align = vec_lvsr( 0, to ); // permute map to misalign data
1111
+ MSQ = vec_perm(edges,(Packet16uc)from,align); // misalign the data (MSQ)
1112
+ LSQ = vec_perm((Packet16uc)from,edges,align); // misalign the data (LSQ)
1113
+ vec_st( LSQ, 15, (unsigned char *)to ); // Store the LSQ part first
1114
+ vec_st( MSQ, 0, (unsigned char *)to ); // Store the MSQ part second
1115
+ #endif
1116
+ }
1117
+ template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from)
1118
+ {
1119
+ pstoreu_common<Packet4f>(to, from);
1120
+ }
1121
+ template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from)
1122
+ {
1123
+ pstoreu_common<Packet4i>(to, from);
1124
+ }
1125
+ template<> EIGEN_STRONG_INLINE void pstoreu<short int>(short int* to, const Packet8s& from)
1126
+ {
1127
+ pstoreu_common<Packet8s>(to, from);
1128
+ }
1129
+ template<> EIGEN_STRONG_INLINE void pstoreu<unsigned short int>(unsigned short int* to, const Packet8us& from)
1130
+ {
1131
+ pstoreu_common<Packet8us>(to, from);
1132
+ }
1133
+ template<> EIGEN_STRONG_INLINE void pstoreu<bfloat16>(bfloat16* to, const Packet8bf& from)
1134
+ {
1135
+ pstoreu_common<Packet8us>(reinterpret_cast<unsigned short int*>(to), from);
1136
+ }
1137
+ template<> EIGEN_STRONG_INLINE void pstoreu<signed char>(signed char* to, const Packet16c& from)
1138
+ {
1139
+ pstoreu_common<Packet16c>(to, from);
1140
+ }
1141
+ template<> EIGEN_STRONG_INLINE void pstoreu<unsigned char>(unsigned char* to, const Packet16uc& from)
1142
+ {
1143
+ pstoreu_common<Packet16uc>(to, from);
1144
+ }
1145
+
1146
+ template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { EIGEN_PPC_PREFETCH(addr); }
1147
+ template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { EIGEN_PPC_PREFETCH(addr); }
1148
+
1149
+ template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { EIGEN_ALIGN16 float x; vec_ste(a, 0, &x); return x; }
1150
+ template<> EIGEN_STRONG_INLINE int pfirst<Packet4i>(const Packet4i& a) { EIGEN_ALIGN16 int x; vec_ste(a, 0, &x); return x; }
1151
+
1152
+ template<typename Packet> EIGEN_STRONG_INLINE __UNPACK_TYPE__(Packet) pfirst_common(const Packet& a) {
1153
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) x;
1154
+ vec_ste(a, 0, &x);
1155
+ return x;
1156
+ }
1157
+
1158
+ template<> EIGEN_STRONG_INLINE short int pfirst<Packet8s>(const Packet8s& a) {
1159
+ return pfirst_common<Packet8s>(a);
1160
+ }
1161
+
1162
+ template<> EIGEN_STRONG_INLINE unsigned short int pfirst<Packet8us>(const Packet8us& a) {
1163
+ return pfirst_common<Packet8us>(a);
1164
+ }
1165
+
1166
+ template<> EIGEN_STRONG_INLINE signed char pfirst<Packet16c>(const Packet16c& a)
1167
+ {
1168
+ return pfirst_common<Packet16c>(a);
1169
+ }
1170
+
1171
+ template<> EIGEN_STRONG_INLINE unsigned char pfirst<Packet16uc>(const Packet16uc& a)
1172
+ {
1173
+ return pfirst_common<Packet16uc>(a);
1174
+ }
1175
+
1176
+ template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a)
1177
+ {
1178
+ return reinterpret_cast<Packet4f>(vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE32));
1179
+ }
1180
+ template<> EIGEN_STRONG_INLINE Packet4i preverse(const Packet4i& a)
1181
+ {
1182
+ return reinterpret_cast<Packet4i>(vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE32));
1183
+ }
1184
+ template<> EIGEN_STRONG_INLINE Packet8s preverse(const Packet8s& a)
1185
+ {
1186
+ return reinterpret_cast<Packet8s>(vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE16));
1187
+ }
1188
+ template<> EIGEN_STRONG_INLINE Packet8us preverse(const Packet8us& a)
1189
+ {
1190
+ return reinterpret_cast<Packet8us>(vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE16));
1191
+ }
1192
+ template<> EIGEN_STRONG_INLINE Packet16c preverse(const Packet16c& a)
1193
+ {
1194
+ return vec_perm(a, a, p16uc_REVERSE8);
1195
+ }
1196
+ template<> EIGEN_STRONG_INLINE Packet16uc preverse(const Packet16uc& a)
1197
+ {
1198
+ return vec_perm(a, a, p16uc_REVERSE8);
1199
+ }
1200
+ template<> EIGEN_STRONG_INLINE Packet8bf preverse(const Packet8bf& a)
1201
+ {
1202
+ return preverse<Packet8us>(a);
1203
+ }
1204
+
1205
+ template<> EIGEN_STRONG_INLINE Packet4f pabs(const Packet4f& a) { return vec_abs(a); }
1206
+ template<> EIGEN_STRONG_INLINE Packet4i pabs(const Packet4i& a) { return vec_abs(a); }
1207
+ template<> EIGEN_STRONG_INLINE Packet8s pabs(const Packet8s& a) { return vec_abs(a); }
1208
+ template<> EIGEN_STRONG_INLINE Packet8us pabs(const Packet8us& a) { return a; }
1209
+ template<> EIGEN_STRONG_INLINE Packet16c pabs(const Packet16c& a) { return vec_abs(a); }
1210
+ template<> EIGEN_STRONG_INLINE Packet16uc pabs(const Packet16uc& a) { return a; }
1211
+ template<> EIGEN_STRONG_INLINE Packet8bf pabs(const Packet8bf& a) {
1212
+ _EIGEN_DECLARE_CONST_FAST_Packet8us(abs_mask,0x7FFF);
1213
+ return pand<Packet8us>(p8us_abs_mask, a);
1214
+ }
1215
+
1216
+ template<int N> EIGEN_STRONG_INLINE Packet4i parithmetic_shift_right(const Packet4i& a)
1217
+ { return vec_sra(a,reinterpret_cast<Packet4ui>(pset1<Packet4i>(N))); }
1218
+ template<int N> EIGEN_STRONG_INLINE Packet4i plogical_shift_right(const Packet4i& a)
1219
+ { return vec_sr(a,reinterpret_cast<Packet4ui>(pset1<Packet4i>(N))); }
1220
+ template<int N> EIGEN_STRONG_INLINE Packet4i plogical_shift_left(const Packet4i& a)
1221
+ { return vec_sl(a,reinterpret_cast<Packet4ui>(pset1<Packet4i>(N))); }
1222
+ template<int N> EIGEN_STRONG_INLINE Packet4f plogical_shift_left(const Packet4f& a)
1223
+ {
1224
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(mask, N);
1225
+ Packet4ui r = vec_sl(reinterpret_cast<Packet4ui>(a), p4ui_mask);
1226
+ return reinterpret_cast<Packet4f>(r);
1227
+ }
1228
+
1229
+ template<int N> EIGEN_STRONG_INLINE Packet4f plogical_shift_right(const Packet4f& a)
1230
+ {
1231
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(mask, N);
1232
+ Packet4ui r = vec_sr(reinterpret_cast<Packet4ui>(a), p4ui_mask);
1233
+ return reinterpret_cast<Packet4f>(r);
1234
+ }
1235
+
1236
+ template<int N> EIGEN_STRONG_INLINE Packet4ui plogical_shift_right(const Packet4ui& a)
1237
+ {
1238
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(mask, N);
1239
+ return vec_sr(a, p4ui_mask);
1240
+ }
1241
+
1242
+ template<int N> EIGEN_STRONG_INLINE Packet4ui plogical_shift_left(const Packet4ui& a)
1243
+ {
1244
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(mask, N);
1245
+ return vec_sl(a, p4ui_mask);
1246
+ }
1247
+
1248
+ template<int N> EIGEN_STRONG_INLINE Packet8us plogical_shift_left(const Packet8us& a)
1249
+ {
1250
+ const _EIGEN_DECLARE_CONST_FAST_Packet8us(mask, N);
1251
+ return vec_sl(a, p8us_mask);
1252
+ }
1253
+ template<int N> EIGEN_STRONG_INLINE Packet8us plogical_shift_right(const Packet8us& a)
1254
+ {
1255
+ const _EIGEN_DECLARE_CONST_FAST_Packet8us(mask, N);
1256
+ return vec_sr(a, p8us_mask);
1257
+ }
1258
+
1259
+ EIGEN_STRONG_INLINE Packet4f Bf16ToF32Even(const Packet8bf& bf){
1260
+ return plogical_shift_left<16>(reinterpret_cast<Packet4f>(bf.m_val));
1261
+ }
1262
+
1263
+ EIGEN_STRONG_INLINE Packet4f Bf16ToF32Odd(const Packet8bf& bf){
1264
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(high_mask, 0xFFFF0000);
1265
+ return pand<Packet4f>(
1266
+ reinterpret_cast<Packet4f>(bf.m_val),
1267
+ reinterpret_cast<Packet4f>(p4ui_high_mask)
1268
+ );
1269
+ }
1270
+
1271
+ // Simple interleaving of bool masks, prevents true values from being
1272
+ // converted to NaNs.
1273
+ EIGEN_STRONG_INLINE Packet8bf F32ToBf16Bool(Packet4f even, Packet4f odd) {
1274
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(high_mask, 0xFFFF0000);
1275
+ Packet4f bf_odd, bf_even;
1276
+ bf_odd = pand(reinterpret_cast<Packet4f>(p4ui_high_mask), odd);
1277
+ bf_even = plogical_shift_right<16>(even);
1278
+ return reinterpret_cast<Packet8us>(por<Packet4f>(bf_even, bf_odd));
1279
+ }
1280
+
1281
+ EIGEN_STRONG_INLINE Packet8bf F32ToBf16(Packet4f p4f){
1282
+ Packet4ui input = reinterpret_cast<Packet4ui>(p4f);
1283
+ Packet4ui lsb = plogical_shift_right<16>(input);
1284
+ lsb = pand<Packet4ui>(lsb, reinterpret_cast<Packet4ui>(p4i_ONE));
1285
+
1286
+ _EIGEN_DECLARE_CONST_FAST_Packet4ui(BIAS,0x7FFFu);
1287
+ Packet4ui rounding_bias = padd<Packet4ui>(lsb, p4ui_BIAS);
1288
+ input = padd<Packet4ui>(input, rounding_bias);
1289
+
1290
+ //Test NaN and Subnormal - Begin
1291
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(exp_mask, 0x7F800000);
1292
+ Packet4ui exp = pand<Packet4ui>(p4ui_exp_mask, reinterpret_cast<Packet4ui>(p4f));
1293
+
1294
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(mantissa_mask, 0x7FFFFF);
1295
+ Packet4ui mantissa = pand<Packet4ui>(p4ui_mantissa_mask, reinterpret_cast<Packet4ui>(p4f));
1296
+
1297
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(max_exp, 0x7F800000);
1298
+ Packet4bi is_max_exp = vec_cmpeq(exp, p4ui_max_exp);
1299
+ Packet4bi is_zero_exp = vec_cmpeq(exp, reinterpret_cast<Packet4ui>(p4i_ZERO));
1300
+
1301
+ Packet4bi is_mant_zero = vec_cmpeq(mantissa, reinterpret_cast<Packet4ui>(p4i_ZERO));
1302
+ Packet4ui nan_selector = pandnot<Packet4ui>(
1303
+ reinterpret_cast<Packet4ui>(is_max_exp),
1304
+ reinterpret_cast<Packet4ui>(is_mant_zero)
1305
+ );
1306
+
1307
+ Packet4ui subnormal_selector = pandnot<Packet4ui>(
1308
+ reinterpret_cast<Packet4ui>(is_zero_exp),
1309
+ reinterpret_cast<Packet4ui>(is_mant_zero)
1310
+ );
1311
+
1312
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(nan, 0x7FC00000);
1313
+ input = vec_sel(input, p4ui_nan, nan_selector);
1314
+ input = vec_sel(input, reinterpret_cast<Packet4ui>(p4f), subnormal_selector);
1315
+ //Test NaN and Subnormal - End
1316
+
1317
+ input = plogical_shift_right<16>(input);
1318
+ return reinterpret_cast<Packet8us>(input);
1319
+ }
1320
+
1321
+ EIGEN_STRONG_INLINE Packet8bf F32ToBf16(Packet4f even, Packet4f odd){
1322
+ Packet4f bf_odd, bf_even;
1323
+ bf_odd = reinterpret_cast<Packet4f>(F32ToBf16(odd).m_val);
1324
+ bf_odd = plogical_shift_left<16>(bf_odd);
1325
+ bf_even = reinterpret_cast<Packet4f>(F32ToBf16(even).m_val);
1326
+ return reinterpret_cast<Packet8us>(por<Packet4f>(bf_even, bf_odd));
1327
+ }
1328
+ #define BF16_TO_F32_UNARY_OP_WRAPPER(OP, A) \
1329
+ Packet4f a_even = Bf16ToF32Even(A);\
1330
+ Packet4f a_odd = Bf16ToF32Odd(A);\
1331
+ Packet4f op_even = OP(a_even);\
1332
+ Packet4f op_odd = OP(a_odd);\
1333
+ return F32ToBf16(op_even, op_odd);\
1334
+
1335
+ #define BF16_TO_F32_BINARY_OP_WRAPPER(OP, A, B) \
1336
+ Packet4f a_even = Bf16ToF32Even(A);\
1337
+ Packet4f a_odd = Bf16ToF32Odd(A);\
1338
+ Packet4f b_even = Bf16ToF32Even(B);\
1339
+ Packet4f b_odd = Bf16ToF32Odd(B);\
1340
+ Packet4f op_even = OP(a_even, b_even);\
1341
+ Packet4f op_odd = OP(a_odd, b_odd);\
1342
+ return F32ToBf16(op_even, op_odd);\
1343
+
1344
+ #define BF16_TO_F32_BINARY_OP_WRAPPER_BOOL(OP, A, B) \
1345
+ Packet4f a_even = Bf16ToF32Even(A);\
1346
+ Packet4f a_odd = Bf16ToF32Odd(A);\
1347
+ Packet4f b_even = Bf16ToF32Even(B);\
1348
+ Packet4f b_odd = Bf16ToF32Odd(B);\
1349
+ Packet4f op_even = OP(a_even, b_even);\
1350
+ Packet4f op_odd = OP(a_odd, b_odd);\
1351
+ return F32ToBf16Bool(op_even, op_odd);\
1352
+
1353
+ template<> EIGEN_STRONG_INLINE Packet8bf padd<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
1354
+ BF16_TO_F32_BINARY_OP_WRAPPER(padd<Packet4f>, a, b);
1355
+ }
1356
+
1357
+ template<> EIGEN_STRONG_INLINE Packet8bf pmul<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
1358
+ BF16_TO_F32_BINARY_OP_WRAPPER(pmul<Packet4f>, a, b);
1359
+ }
1360
+
1361
+ template<> EIGEN_STRONG_INLINE Packet8bf pdiv<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
1362
+ BF16_TO_F32_BINARY_OP_WRAPPER(pdiv<Packet4f>, a, b);
1363
+ }
1364
+
1365
+ template<> EIGEN_STRONG_INLINE Packet8bf pnegate<Packet8bf>(const Packet8bf& a) {
1366
+ BF16_TO_F32_UNARY_OP_WRAPPER(pnegate<Packet4f>, a);
1367
+ }
1368
+
1369
+ template<> EIGEN_STRONG_INLINE Packet8bf psub<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
1370
+ BF16_TO_F32_BINARY_OP_WRAPPER(psub<Packet4f>, a, b);
1371
+ }
1372
+
1373
+ template<> EIGEN_STRONG_INLINE Packet4f pldexp<Packet4f>(const Packet4f& a, const Packet4f& exponent) {
1374
+ return pldexp_generic(a,exponent);
1375
+ }
1376
+ template<> EIGEN_STRONG_INLINE Packet8bf pldexp<Packet8bf> (const Packet8bf& a, const Packet8bf& exponent){
1377
+ BF16_TO_F32_BINARY_OP_WRAPPER(pldexp<Packet4f>, a, exponent);
1378
+ }
1379
+
1380
+ template<> EIGEN_STRONG_INLINE Packet4f pfrexp<Packet4f>(const Packet4f& a, Packet4f& exponent) {
1381
+ return pfrexp_generic(a,exponent);
1382
+ }
1383
+ template<> EIGEN_STRONG_INLINE Packet8bf pfrexp<Packet8bf> (const Packet8bf& a, Packet8bf& e){
1384
+ Packet4f a_even = Bf16ToF32Even(a);
1385
+ Packet4f a_odd = Bf16ToF32Odd(a);
1386
+ Packet4f e_even;
1387
+ Packet4f e_odd;
1388
+ Packet4f op_even = pfrexp<Packet4f>(a_even, e_even);
1389
+ Packet4f op_odd = pfrexp<Packet4f>(a_odd, e_odd);
1390
+ e = F32ToBf16(e_even, e_odd);
1391
+ return F32ToBf16(op_even, op_odd);
1392
+ }
1393
+
1394
+ template<> EIGEN_STRONG_INLINE Packet8bf psin<Packet8bf> (const Packet8bf& a){
1395
+ BF16_TO_F32_UNARY_OP_WRAPPER(psin_float, a);
1396
+ }
1397
+ template<> EIGEN_STRONG_INLINE Packet8bf pcos<Packet8bf> (const Packet8bf& a){
1398
+ BF16_TO_F32_UNARY_OP_WRAPPER(pcos_float, a);
1399
+ }
1400
+ template<> EIGEN_STRONG_INLINE Packet8bf plog<Packet8bf> (const Packet8bf& a){
1401
+ BF16_TO_F32_UNARY_OP_WRAPPER(plog_float, a);
1402
+ }
1403
+ template<> EIGEN_STRONG_INLINE Packet8bf pfloor<Packet8bf> (const Packet8bf& a){
1404
+ BF16_TO_F32_UNARY_OP_WRAPPER(pfloor<Packet4f>, a);
1405
+ }
1406
+ template<> EIGEN_STRONG_INLINE Packet8bf pceil<Packet8bf> (const Packet8bf& a){
1407
+ BF16_TO_F32_UNARY_OP_WRAPPER(pceil<Packet4f>, a);
1408
+ }
1409
+ template<> EIGEN_STRONG_INLINE Packet8bf pround<Packet8bf> (const Packet8bf& a){
1410
+ BF16_TO_F32_UNARY_OP_WRAPPER(pround<Packet4f>, a);
1411
+ }
1412
+ #ifdef __VSX__
1413
+ template<> EIGEN_STRONG_INLINE Packet8bf print<Packet8bf> (const Packet8bf& a){
1414
+ BF16_TO_F32_UNARY_OP_WRAPPER(print<Packet4f>, a);
1415
+ }
1416
+ #endif
1417
+ template<> EIGEN_STRONG_INLINE Packet8bf pmadd(const Packet8bf& a, const Packet8bf& b, const Packet8bf& c) {
1418
+ Packet4f a_even = Bf16ToF32Even(a);
1419
+ Packet4f a_odd = Bf16ToF32Odd(a);
1420
+ Packet4f b_even = Bf16ToF32Even(b);
1421
+ Packet4f b_odd = Bf16ToF32Odd(b);
1422
+ Packet4f c_even = Bf16ToF32Even(c);
1423
+ Packet4f c_odd = Bf16ToF32Odd(c);
1424
+ Packet4f pmadd_even = pmadd<Packet4f>(a_even, b_even, c_even);
1425
+ Packet4f pmadd_odd = pmadd<Packet4f>(a_odd, b_odd, c_odd);
1426
+ return F32ToBf16(pmadd_even, pmadd_odd);
1427
+ }
1428
+
1429
+ template<> EIGEN_STRONG_INLINE Packet8bf pmin<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
1430
+ BF16_TO_F32_BINARY_OP_WRAPPER(pmin<Packet4f>, a, b);
1431
+ }
1432
+
1433
+ template<> EIGEN_STRONG_INLINE Packet8bf pmax<Packet8bf>(const Packet8bf& a, const Packet8bf& b) {
1434
+ BF16_TO_F32_BINARY_OP_WRAPPER(pmax<Packet4f>, a, b);
1435
+ }
1436
+
1437
+ template<> EIGEN_STRONG_INLINE Packet8bf pcmp_lt(const Packet8bf& a, const Packet8bf& b) {
1438
+ BF16_TO_F32_BINARY_OP_WRAPPER_BOOL(pcmp_lt<Packet4f>, a, b);
1439
+ }
1440
+ template<> EIGEN_STRONG_INLINE Packet8bf pcmp_lt_or_nan(const Packet8bf& a, const Packet8bf& b) {
1441
+ BF16_TO_F32_BINARY_OP_WRAPPER_BOOL(pcmp_lt_or_nan<Packet4f>, a, b);
1442
+ }
1443
+ template<> EIGEN_STRONG_INLINE Packet8bf pcmp_le(const Packet8bf& a, const Packet8bf& b) {
1444
+ BF16_TO_F32_BINARY_OP_WRAPPER_BOOL(pcmp_le<Packet4f>, a, b);
1445
+ }
1446
+ template<> EIGEN_STRONG_INLINE Packet8bf pcmp_eq(const Packet8bf& a, const Packet8bf& b) {
1447
+ BF16_TO_F32_BINARY_OP_WRAPPER_BOOL(pcmp_eq<Packet4f>, a, b);
1448
+ }
1449
+
1450
+ template<> EIGEN_STRONG_INLINE bfloat16 pfirst(const Packet8bf& a) {
1451
+ return Eigen::bfloat16_impl::raw_uint16_to_bfloat16((pfirst<Packet8us>(a)));
1452
+ }
1453
+
1454
+ template<> EIGEN_STRONG_INLINE Packet8bf ploaddup<Packet8bf>(const bfloat16* from)
1455
+ {
1456
+ return ploaddup<Packet8us>(reinterpret_cast<const unsigned short int*>(from));
1457
+ }
1458
+
1459
+ template<> EIGEN_STRONG_INLINE Packet8bf plset<Packet8bf>(const bfloat16& a) {
1460
+ bfloat16 countdown[8] = { bfloat16(0), bfloat16(1), bfloat16(2), bfloat16(3),
1461
+ bfloat16(4), bfloat16(5), bfloat16(6), bfloat16(7) };
1462
+ return padd<Packet8bf>(pset1<Packet8bf>(a), pload<Packet8bf>(countdown));
1463
+ }
1464
+
1465
+ template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)
1466
+ {
1467
+ Packet4f b, sum;
1468
+ b = vec_sld(a, a, 8);
1469
+ sum = a + b;
1470
+ b = vec_sld(sum, sum, 4);
1471
+ sum += b;
1472
+ return pfirst(sum);
1473
+ }
1474
+
1475
+ template<> EIGEN_STRONG_INLINE int predux<Packet4i>(const Packet4i& a)
1476
+ {
1477
+ Packet4i sum;
1478
+ sum = vec_sums(a, p4i_ZERO);
1479
+ #ifdef _BIG_ENDIAN
1480
+ sum = vec_sld(sum, p4i_ZERO, 12);
1481
+ #else
1482
+ sum = vec_sld(p4i_ZERO, sum, 4);
1483
+ #endif
1484
+ return pfirst(sum);
1485
+ }
1486
+
1487
+ template<> EIGEN_STRONG_INLINE bfloat16 predux<Packet8bf>(const Packet8bf& a)
1488
+ {
1489
+ float redux_even = predux<Packet4f>(Bf16ToF32Even(a));
1490
+ float redux_odd = predux<Packet4f>(Bf16ToF32Odd(a));
1491
+ float f32_result = redux_even + redux_odd;
1492
+ return bfloat16(f32_result);
1493
+ }
1494
+ template<typename Packet> EIGEN_STRONG_INLINE __UNPACK_TYPE__(Packet) predux_size8(const Packet& a)
1495
+ {
1496
+ union{
1497
+ Packet v;
1498
+ __UNPACK_TYPE__(Packet) n[8];
1499
+ } vt;
1500
+ vt.v = a;
1501
+
1502
+ EIGEN_ALIGN16 int first_loader[4] = { vt.n[0], vt.n[1], vt.n[2], vt.n[3] };
1503
+ EIGEN_ALIGN16 int second_loader[4] = { vt.n[4], vt.n[5], vt.n[6], vt.n[7] };
1504
+ Packet4i first_half = pload<Packet4i>(first_loader);
1505
+ Packet4i second_half = pload<Packet4i>(second_loader);
1506
+
1507
+ return static_cast<__UNPACK_TYPE__(Packet)>(predux(first_half) + predux(second_half));
1508
+ }
1509
+
1510
+ template<> EIGEN_STRONG_INLINE short int predux<Packet8s>(const Packet8s& a)
1511
+ {
1512
+ return predux_size8<Packet8s>(a);
1513
+ }
1514
+
1515
+ template<> EIGEN_STRONG_INLINE unsigned short int predux<Packet8us>(const Packet8us& a)
1516
+ {
1517
+ return predux_size8<Packet8us>(a);
1518
+ }
1519
+
1520
+ template<typename Packet> EIGEN_STRONG_INLINE __UNPACK_TYPE__(Packet) predux_size16(const Packet& a)
1521
+ {
1522
+ union{
1523
+ Packet v;
1524
+ __UNPACK_TYPE__(Packet) n[16];
1525
+ } vt;
1526
+ vt.v = a;
1527
+
1528
+ EIGEN_ALIGN16 int first_loader[4] = { vt.n[0], vt.n[1], vt.n[2], vt.n[3] };
1529
+ EIGEN_ALIGN16 int second_loader[4] = { vt.n[4], vt.n[5], vt.n[6], vt.n[7] };
1530
+ EIGEN_ALIGN16 int third_loader[4] = { vt.n[8], vt.n[9], vt.n[10], vt.n[11] };
1531
+ EIGEN_ALIGN16 int fourth_loader[4] = { vt.n[12], vt.n[13], vt.n[14], vt.n[15] };
1532
+
1533
+ Packet4i first_quarter = pload<Packet4i>(first_loader);
1534
+ Packet4i second_quarter = pload<Packet4i>(second_loader);
1535
+ Packet4i third_quarter = pload<Packet4i>(third_loader);
1536
+ Packet4i fourth_quarter = pload<Packet4i>(fourth_loader);
1537
+
1538
+ return static_cast<__UNPACK_TYPE__(Packet)>(predux(first_quarter) + predux(second_quarter)
1539
+ + predux(third_quarter) + predux(fourth_quarter));
1540
+ }
1541
+
1542
+ template<> EIGEN_STRONG_INLINE signed char predux<Packet16c>(const Packet16c& a)
1543
+ {
1544
+ return predux_size16<Packet16c>(a);
1545
+ }
1546
+
1547
+ template<> EIGEN_STRONG_INLINE unsigned char predux<Packet16uc>(const Packet16uc& a)
1548
+ {
1549
+ return predux_size16<Packet16uc>(a);
1550
+ }
1551
+
1552
+ // Other reduction functions:
1553
+ // mul
1554
+ template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)
1555
+ {
1556
+ Packet4f prod;
1557
+ prod = pmul(a, vec_sld(a, a, 8));
1558
+ return pfirst(pmul(prod, vec_sld(prod, prod, 4)));
1559
+ }
1560
+
1561
+ template<> EIGEN_STRONG_INLINE int predux_mul<Packet4i>(const Packet4i& a)
1562
+ {
1563
+ EIGEN_ALIGN16 int aux[4];
1564
+ pstore(aux, a);
1565
+ return aux[0] * aux[1] * aux[2] * aux[3];
1566
+ }
1567
+
1568
+ template<> EIGEN_STRONG_INLINE short int predux_mul<Packet8s>(const Packet8s& a)
1569
+ {
1570
+ Packet8s pair, quad, octo;
1571
+
1572
+ pair = vec_mul(a, vec_sld(a, a, 8));
1573
+ quad = vec_mul(pair, vec_sld(pair, pair, 4));
1574
+ octo = vec_mul(quad, vec_sld(quad, quad, 2));
1575
+
1576
+ return pfirst(octo);
1577
+ }
1578
+
1579
+ template<> EIGEN_STRONG_INLINE unsigned short int predux_mul<Packet8us>(const Packet8us& a)
1580
+ {
1581
+ Packet8us pair, quad, octo;
1582
+
1583
+ pair = vec_mul(a, vec_sld(a, a, 8));
1584
+ quad = vec_mul(pair, vec_sld(pair, pair, 4));
1585
+ octo = vec_mul(quad, vec_sld(quad, quad, 2));
1586
+
1587
+ return pfirst(octo);
1588
+ }
1589
+
1590
+ template<> EIGEN_STRONG_INLINE bfloat16 predux_mul<Packet8bf>(const Packet8bf& a)
1591
+ {
1592
+ float redux_even = predux_mul<Packet4f>(Bf16ToF32Even(a));
1593
+ float redux_odd = predux_mul<Packet4f>(Bf16ToF32Odd(a));
1594
+ float f32_result = redux_even * redux_odd;
1595
+ return bfloat16(f32_result);
1596
+ }
1597
+
1598
+
1599
+ template<> EIGEN_STRONG_INLINE signed char predux_mul<Packet16c>(const Packet16c& a)
1600
+ {
1601
+ Packet16c pair, quad, octo, result;
1602
+
1603
+ pair = vec_mul(a, vec_sld(a, a, 8));
1604
+ quad = vec_mul(pair, vec_sld(pair, pair, 4));
1605
+ octo = vec_mul(quad, vec_sld(quad, quad, 2));
1606
+ result = vec_mul(octo, vec_sld(octo, octo, 1));
1607
+
1608
+ return pfirst(result);
1609
+ }
1610
+
1611
+ template<> EIGEN_STRONG_INLINE unsigned char predux_mul<Packet16uc>(const Packet16uc& a)
1612
+ {
1613
+ Packet16uc pair, quad, octo, result;
1614
+
1615
+ pair = vec_mul(a, vec_sld(a, a, 8));
1616
+ quad = vec_mul(pair, vec_sld(pair, pair, 4));
1617
+ octo = vec_mul(quad, vec_sld(quad, quad, 2));
1618
+ result = vec_mul(octo, vec_sld(octo, octo, 1));
1619
+
1620
+ return pfirst(result);
1621
+ }
1622
+
1623
+ // min
1624
+ template<typename Packet> EIGEN_STRONG_INLINE
1625
+ __UNPACK_TYPE__(Packet) predux_min4(const Packet& a)
1626
+ {
1627
+ Packet b, res;
1628
+ b = vec_min(a, vec_sld(a, a, 8));
1629
+ res = vec_min(b, vec_sld(b, b, 4));
1630
+ return pfirst(res);
1631
+ }
1632
+
1633
+
1634
+ template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)
1635
+ {
1636
+ return predux_min4<Packet4f>(a);
1637
+ }
1638
+
1639
+ template<> EIGEN_STRONG_INLINE int predux_min<Packet4i>(const Packet4i& a)
1640
+ {
1641
+ return predux_min4<Packet4i>(a);
1642
+ }
1643
+
1644
+ template<> EIGEN_STRONG_INLINE bfloat16 predux_min<Packet8bf>(const Packet8bf& a)
1645
+ {
1646
+ float redux_even = predux_min<Packet4f>(Bf16ToF32Even(a));
1647
+ float redux_odd = predux_min<Packet4f>(Bf16ToF32Odd(a));
1648
+ float f32_result = (std::min)(redux_even, redux_odd);
1649
+ return bfloat16(f32_result);
1650
+ }
1651
+
1652
+ template<> EIGEN_STRONG_INLINE short int predux_min<Packet8s>(const Packet8s& a)
1653
+ {
1654
+ Packet8s pair, quad, octo;
1655
+
1656
+ //pair = { Min(a0,a4), Min(a1,a5), Min(a2,a6), Min(a3,a7) }
1657
+ pair = vec_min(a, vec_sld(a, a, 8));
1658
+
1659
+ //quad = { Min(a0, a4, a2, a6), Min(a1, a5, a3, a7) }
1660
+ quad = vec_min(pair, vec_sld(pair, pair, 4));
1661
+
1662
+ //octo = { Min(a0, a4, a2, a6, a1, a5, a3, a7) }
1663
+ octo = vec_min(quad, vec_sld(quad, quad, 2));
1664
+ return pfirst(octo);
1665
+ }
1666
+
1667
+ template<> EIGEN_STRONG_INLINE unsigned short int predux_min<Packet8us>(const Packet8us& a)
1668
+ {
1669
+ Packet8us pair, quad, octo;
1670
+
1671
+ //pair = { Min(a0,a4), Min(a1,a5), Min(a2,a6), Min(a3,a7) }
1672
+ pair = vec_min(a, vec_sld(a, a, 8));
1673
+
1674
+ //quad = { Min(a0, a4, a2, a6), Min(a1, a5, a3, a7) }
1675
+ quad = vec_min(pair, vec_sld(pair, pair, 4));
1676
+
1677
+ //octo = { Min(a0, a4, a2, a6, a1, a5, a3, a7) }
1678
+ octo = vec_min(quad, vec_sld(quad, quad, 2));
1679
+ return pfirst(octo);
1680
+ }
1681
+
1682
+ template<> EIGEN_STRONG_INLINE signed char predux_min<Packet16c>(const Packet16c& a)
1683
+ {
1684
+ Packet16c pair, quad, octo, result;
1685
+
1686
+ pair = vec_min(a, vec_sld(a, a, 8));
1687
+ quad = vec_min(pair, vec_sld(pair, pair, 4));
1688
+ octo = vec_min(quad, vec_sld(quad, quad, 2));
1689
+ result = vec_min(octo, vec_sld(octo, octo, 1));
1690
+
1691
+ return pfirst(result);
1692
+ }
1693
+
1694
+ template<> EIGEN_STRONG_INLINE unsigned char predux_min<Packet16uc>(const Packet16uc& a)
1695
+ {
1696
+ Packet16uc pair, quad, octo, result;
1697
+
1698
+ pair = vec_min(a, vec_sld(a, a, 8));
1699
+ quad = vec_min(pair, vec_sld(pair, pair, 4));
1700
+ octo = vec_min(quad, vec_sld(quad, quad, 2));
1701
+ result = vec_min(octo, vec_sld(octo, octo, 1));
1702
+
1703
+ return pfirst(result);
1704
+ }
1705
+ // max
1706
+ template<typename Packet> EIGEN_STRONG_INLINE __UNPACK_TYPE__(Packet) predux_max4(const Packet& a)
1707
+ {
1708
+ Packet b, res;
1709
+ b = vec_max(a, vec_sld(a, a, 8));
1710
+ res = vec_max(b, vec_sld(b, b, 4));
1711
+ return pfirst(res);
1712
+ }
1713
+
1714
+ template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)
1715
+ {
1716
+ return predux_max4<Packet4f>(a);
1717
+ }
1718
+
1719
+ template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
1720
+ {
1721
+ return predux_max4<Packet4i>(a);
1722
+ }
1723
+
1724
+ template<> EIGEN_STRONG_INLINE bfloat16 predux_max<Packet8bf>(const Packet8bf& a)
1725
+ {
1726
+ float redux_even = predux_max<Packet4f>(Bf16ToF32Even(a));
1727
+ float redux_odd = predux_max<Packet4f>(Bf16ToF32Odd(a));
1728
+ float f32_result = (std::max)(redux_even, redux_odd);
1729
+ return bfloat16(f32_result);
1730
+ }
1731
+
1732
+ template<> EIGEN_STRONG_INLINE short int predux_max<Packet8s>(const Packet8s& a)
1733
+ {
1734
+ Packet8s pair, quad, octo;
1735
+
1736
+ //pair = { Max(a0,a4), Max(a1,a5), Max(a2,a6), Max(a3,a7) }
1737
+ pair = vec_max(a, vec_sld(a, a, 8));
1738
+
1739
+ //quad = { Max(a0, a4, a2, a6), Max(a1, a5, a3, a7) }
1740
+ quad = vec_max(pair, vec_sld(pair, pair, 4));
1741
+
1742
+ //octo = { Max(a0, a4, a2, a6, a1, a5, a3, a7) }
1743
+ octo = vec_max(quad, vec_sld(quad, quad, 2));
1744
+ return pfirst(octo);
1745
+ }
1746
+
1747
+ template<> EIGEN_STRONG_INLINE unsigned short int predux_max<Packet8us>(const Packet8us& a)
1748
+ {
1749
+ Packet8us pair, quad, octo;
1750
+
1751
+ //pair = { Max(a0,a4), Max(a1,a5), Max(a2,a6), Max(a3,a7) }
1752
+ pair = vec_max(a, vec_sld(a, a, 8));
1753
+
1754
+ //quad = { Max(a0, a4, a2, a6), Max(a1, a5, a3, a7) }
1755
+ quad = vec_max(pair, vec_sld(pair, pair, 4));
1756
+
1757
+ //octo = { Max(a0, a4, a2, a6, a1, a5, a3, a7) }
1758
+ octo = vec_max(quad, vec_sld(quad, quad, 2));
1759
+ return pfirst(octo);
1760
+ }
1761
+
1762
+ template<> EIGEN_STRONG_INLINE signed char predux_max<Packet16c>(const Packet16c& a)
1763
+ {
1764
+ Packet16c pair, quad, octo, result;
1765
+
1766
+ pair = vec_max(a, vec_sld(a, a, 8));
1767
+ quad = vec_max(pair, vec_sld(pair, pair, 4));
1768
+ octo = vec_max(quad, vec_sld(quad, quad, 2));
1769
+ result = vec_max(octo, vec_sld(octo, octo, 1));
1770
+
1771
+ return pfirst(result);
1772
+ }
1773
+
1774
+ template<> EIGEN_STRONG_INLINE unsigned char predux_max<Packet16uc>(const Packet16uc& a)
1775
+ {
1776
+ Packet16uc pair, quad, octo, result;
1777
+
1778
+ pair = vec_max(a, vec_sld(a, a, 8));
1779
+ quad = vec_max(pair, vec_sld(pair, pair, 4));
1780
+ octo = vec_max(quad, vec_sld(quad, quad, 2));
1781
+ result = vec_max(octo, vec_sld(octo, octo, 1));
1782
+
1783
+ return pfirst(result);
1784
+ }
1785
+
1786
+ template<> EIGEN_STRONG_INLINE bool predux_any(const Packet4f& x)
1787
+ {
1788
+ return vec_any_ne(x, pzero(x));
1789
+ }
1790
+
1791
+ template <typename T> EIGEN_DEVICE_FUNC inline void
1792
+ ptranpose_common(PacketBlock<T,4>& kernel){
1793
+ T t0, t1, t2, t3;
1794
+ t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);
1795
+ t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);
1796
+ t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);
1797
+ t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);
1798
+ kernel.packet[0] = vec_mergeh(t0, t2);
1799
+ kernel.packet[1] = vec_mergel(t0, t2);
1800
+ kernel.packet[2] = vec_mergeh(t1, t3);
1801
+ kernel.packet[3] = vec_mergel(t1, t3);
1802
+ }
1803
+
1804
+ EIGEN_DEVICE_FUNC inline void
1805
+ ptranspose(PacketBlock<Packet4f,4>& kernel) {
1806
+ ptranpose_common<Packet4f>(kernel);
1807
+ }
1808
+
1809
+ EIGEN_DEVICE_FUNC inline void
1810
+ ptranspose(PacketBlock<Packet4i,4>& kernel) {
1811
+ ptranpose_common<Packet4i>(kernel);
1812
+ }
1813
+
1814
+ EIGEN_DEVICE_FUNC inline void
1815
+ ptranspose(PacketBlock<Packet8s,4>& kernel) {
1816
+ Packet8s t0, t1, t2, t3;
1817
+ t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);
1818
+ t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);
1819
+ t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);
1820
+ t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);
1821
+ kernel.packet[0] = vec_mergeh(t0, t2);
1822
+ kernel.packet[1] = vec_mergel(t0, t2);
1823
+ kernel.packet[2] = vec_mergeh(t1, t3);
1824
+ kernel.packet[3] = vec_mergel(t1, t3);
1825
+ }
1826
+
1827
+ EIGEN_DEVICE_FUNC inline void
1828
+ ptranspose(PacketBlock<Packet8us,4>& kernel) {
1829
+ Packet8us t0, t1, t2, t3;
1830
+ t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);
1831
+ t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);
1832
+ t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);
1833
+ t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);
1834
+ kernel.packet[0] = vec_mergeh(t0, t2);
1835
+ kernel.packet[1] = vec_mergel(t0, t2);
1836
+ kernel.packet[2] = vec_mergeh(t1, t3);
1837
+ kernel.packet[3] = vec_mergel(t1, t3);
1838
+ }
1839
+
1840
+
1841
+ EIGEN_DEVICE_FUNC inline void
1842
+ ptranspose(PacketBlock<Packet8bf,4>& kernel) {
1843
+ Packet8us t0, t1, t2, t3;
1844
+
1845
+ t0 = vec_mergeh(kernel.packet[0].m_val, kernel.packet[2].m_val);
1846
+ t1 = vec_mergel(kernel.packet[0].m_val, kernel.packet[2].m_val);
1847
+ t2 = vec_mergeh(kernel.packet[1].m_val, kernel.packet[3].m_val);
1848
+ t3 = vec_mergel(kernel.packet[1].m_val, kernel.packet[3].m_val);
1849
+ kernel.packet[0] = vec_mergeh(t0, t2);
1850
+ kernel.packet[1] = vec_mergel(t0, t2);
1851
+ kernel.packet[2] = vec_mergeh(t1, t3);
1852
+ kernel.packet[3] = vec_mergel(t1, t3);
1853
+ }
1854
+
1855
+ EIGEN_DEVICE_FUNC inline void
1856
+ ptranspose(PacketBlock<Packet16c,4>& kernel) {
1857
+ Packet16c t0, t1, t2, t3;
1858
+ t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);
1859
+ t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);
1860
+ t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);
1861
+ t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);
1862
+ kernel.packet[0] = vec_mergeh(t0, t2);
1863
+ kernel.packet[1] = vec_mergel(t0, t2);
1864
+ kernel.packet[2] = vec_mergeh(t1, t3);
1865
+ kernel.packet[3] = vec_mergel(t1, t3);
1866
+ }
1867
+
1868
+
1869
+ EIGEN_DEVICE_FUNC inline void
1870
+ ptranspose(PacketBlock<Packet16uc,4>& kernel) {
1871
+ Packet16uc t0, t1, t2, t3;
1872
+ t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);
1873
+ t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);
1874
+ t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);
1875
+ t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);
1876
+ kernel.packet[0] = vec_mergeh(t0, t2);
1877
+ kernel.packet[1] = vec_mergel(t0, t2);
1878
+ kernel.packet[2] = vec_mergeh(t1, t3);
1879
+ kernel.packet[3] = vec_mergel(t1, t3);
1880
+ }
1881
+
1882
+ EIGEN_DEVICE_FUNC inline void
1883
+ ptranspose(PacketBlock<Packet8s,8>& kernel) {
1884
+ Packet8s v[8], sum[8];
1885
+
1886
+ v[0] = vec_mergeh(kernel.packet[0], kernel.packet[4]);
1887
+ v[1] = vec_mergel(kernel.packet[0], kernel.packet[4]);
1888
+ v[2] = vec_mergeh(kernel.packet[1], kernel.packet[5]);
1889
+ v[3] = vec_mergel(kernel.packet[1], kernel.packet[5]);
1890
+ v[4] = vec_mergeh(kernel.packet[2], kernel.packet[6]);
1891
+ v[5] = vec_mergel(kernel.packet[2], kernel.packet[6]);
1892
+ v[6] = vec_mergeh(kernel.packet[3], kernel.packet[7]);
1893
+ v[7] = vec_mergel(kernel.packet[3], kernel.packet[7]);
1894
+ sum[0] = vec_mergeh(v[0], v[4]);
1895
+ sum[1] = vec_mergel(v[0], v[4]);
1896
+ sum[2] = vec_mergeh(v[1], v[5]);
1897
+ sum[3] = vec_mergel(v[1], v[5]);
1898
+ sum[4] = vec_mergeh(v[2], v[6]);
1899
+ sum[5] = vec_mergel(v[2], v[6]);
1900
+ sum[6] = vec_mergeh(v[3], v[7]);
1901
+ sum[7] = vec_mergel(v[3], v[7]);
1902
+
1903
+ kernel.packet[0] = vec_mergeh(sum[0], sum[4]);
1904
+ kernel.packet[1] = vec_mergel(sum[0], sum[4]);
1905
+ kernel.packet[2] = vec_mergeh(sum[1], sum[5]);
1906
+ kernel.packet[3] = vec_mergel(sum[1], sum[5]);
1907
+ kernel.packet[4] = vec_mergeh(sum[2], sum[6]);
1908
+ kernel.packet[5] = vec_mergel(sum[2], sum[6]);
1909
+ kernel.packet[6] = vec_mergeh(sum[3], sum[7]);
1910
+ kernel.packet[7] = vec_mergel(sum[3], sum[7]);
1911
+ }
1912
+
1913
+ EIGEN_DEVICE_FUNC inline void
1914
+ ptranspose(PacketBlock<Packet8us,8>& kernel) {
1915
+ Packet8us v[8], sum[8];
1916
+
1917
+ v[0] = vec_mergeh(kernel.packet[0], kernel.packet[4]);
1918
+ v[1] = vec_mergel(kernel.packet[0], kernel.packet[4]);
1919
+ v[2] = vec_mergeh(kernel.packet[1], kernel.packet[5]);
1920
+ v[3] = vec_mergel(kernel.packet[1], kernel.packet[5]);
1921
+ v[4] = vec_mergeh(kernel.packet[2], kernel.packet[6]);
1922
+ v[5] = vec_mergel(kernel.packet[2], kernel.packet[6]);
1923
+ v[6] = vec_mergeh(kernel.packet[3], kernel.packet[7]);
1924
+ v[7] = vec_mergel(kernel.packet[3], kernel.packet[7]);
1925
+ sum[0] = vec_mergeh(v[0], v[4]);
1926
+ sum[1] = vec_mergel(v[0], v[4]);
1927
+ sum[2] = vec_mergeh(v[1], v[5]);
1928
+ sum[3] = vec_mergel(v[1], v[5]);
1929
+ sum[4] = vec_mergeh(v[2], v[6]);
1930
+ sum[5] = vec_mergel(v[2], v[6]);
1931
+ sum[6] = vec_mergeh(v[3], v[7]);
1932
+ sum[7] = vec_mergel(v[3], v[7]);
1933
+
1934
+ kernel.packet[0] = vec_mergeh(sum[0], sum[4]);
1935
+ kernel.packet[1] = vec_mergel(sum[0], sum[4]);
1936
+ kernel.packet[2] = vec_mergeh(sum[1], sum[5]);
1937
+ kernel.packet[3] = vec_mergel(sum[1], sum[5]);
1938
+ kernel.packet[4] = vec_mergeh(sum[2], sum[6]);
1939
+ kernel.packet[5] = vec_mergel(sum[2], sum[6]);
1940
+ kernel.packet[6] = vec_mergeh(sum[3], sum[7]);
1941
+ kernel.packet[7] = vec_mergel(sum[3], sum[7]);
1942
+ }
1943
+
1944
+ EIGEN_DEVICE_FUNC inline void
1945
+ ptranspose(PacketBlock<Packet8bf,8>& kernel) {
1946
+ Packet8bf v[8], sum[8];
1947
+
1948
+ v[0] = vec_mergeh(kernel.packet[0].m_val, kernel.packet[4].m_val);
1949
+ v[1] = vec_mergel(kernel.packet[0].m_val, kernel.packet[4].m_val);
1950
+ v[2] = vec_mergeh(kernel.packet[1].m_val, kernel.packet[5].m_val);
1951
+ v[3] = vec_mergel(kernel.packet[1].m_val, kernel.packet[5].m_val);
1952
+ v[4] = vec_mergeh(kernel.packet[2].m_val, kernel.packet[6].m_val);
1953
+ v[5] = vec_mergel(kernel.packet[2].m_val, kernel.packet[6].m_val);
1954
+ v[6] = vec_mergeh(kernel.packet[3].m_val, kernel.packet[7].m_val);
1955
+ v[7] = vec_mergel(kernel.packet[3].m_val, kernel.packet[7].m_val);
1956
+ sum[0] = vec_mergeh(v[0].m_val, v[4].m_val);
1957
+ sum[1] = vec_mergel(v[0].m_val, v[4].m_val);
1958
+ sum[2] = vec_mergeh(v[1].m_val, v[5].m_val);
1959
+ sum[3] = vec_mergel(v[1].m_val, v[5].m_val);
1960
+ sum[4] = vec_mergeh(v[2].m_val, v[6].m_val);
1961
+ sum[5] = vec_mergel(v[2].m_val, v[6].m_val);
1962
+ sum[6] = vec_mergeh(v[3].m_val, v[7].m_val);
1963
+ sum[7] = vec_mergel(v[3].m_val, v[7].m_val);
1964
+
1965
+ kernel.packet[0] = vec_mergeh(sum[0].m_val, sum[4].m_val);
1966
+ kernel.packet[1] = vec_mergel(sum[0].m_val, sum[4].m_val);
1967
+ kernel.packet[2] = vec_mergeh(sum[1].m_val, sum[5].m_val);
1968
+ kernel.packet[3] = vec_mergel(sum[1].m_val, sum[5].m_val);
1969
+ kernel.packet[4] = vec_mergeh(sum[2].m_val, sum[6].m_val);
1970
+ kernel.packet[5] = vec_mergel(sum[2].m_val, sum[6].m_val);
1971
+ kernel.packet[6] = vec_mergeh(sum[3].m_val, sum[7].m_val);
1972
+ kernel.packet[7] = vec_mergel(sum[3].m_val, sum[7].m_val);
1973
+ }
1974
+
1975
+ EIGEN_DEVICE_FUNC inline void
1976
+ ptranspose(PacketBlock<Packet16c,16>& kernel) {
1977
+ Packet16c step1[16], step2[16], step3[16];
1978
+
1979
+ step1[0] = vec_mergeh(kernel.packet[0], kernel.packet[8]);
1980
+ step1[1] = vec_mergel(kernel.packet[0], kernel.packet[8]);
1981
+ step1[2] = vec_mergeh(kernel.packet[1], kernel.packet[9]);
1982
+ step1[3] = vec_mergel(kernel.packet[1], kernel.packet[9]);
1983
+ step1[4] = vec_mergeh(kernel.packet[2], kernel.packet[10]);
1984
+ step1[5] = vec_mergel(kernel.packet[2], kernel.packet[10]);
1985
+ step1[6] = vec_mergeh(kernel.packet[3], kernel.packet[11]);
1986
+ step1[7] = vec_mergel(kernel.packet[3], kernel.packet[11]);
1987
+ step1[8] = vec_mergeh(kernel.packet[4], kernel.packet[12]);
1988
+ step1[9] = vec_mergel(kernel.packet[4], kernel.packet[12]);
1989
+ step1[10] = vec_mergeh(kernel.packet[5], kernel.packet[13]);
1990
+ step1[11] = vec_mergel(kernel.packet[5], kernel.packet[13]);
1991
+ step1[12] = vec_mergeh(kernel.packet[6], kernel.packet[14]);
1992
+ step1[13] = vec_mergel(kernel.packet[6], kernel.packet[14]);
1993
+ step1[14] = vec_mergeh(kernel.packet[7], kernel.packet[15]);
1994
+ step1[15] = vec_mergel(kernel.packet[7], kernel.packet[15]);
1995
+
1996
+ step2[0] = vec_mergeh(step1[0], step1[8]);
1997
+ step2[1] = vec_mergel(step1[0], step1[8]);
1998
+ step2[2] = vec_mergeh(step1[1], step1[9]);
1999
+ step2[3] = vec_mergel(step1[1], step1[9]);
2000
+ step2[4] = vec_mergeh(step1[2], step1[10]);
2001
+ step2[5] = vec_mergel(step1[2], step1[10]);
2002
+ step2[6] = vec_mergeh(step1[3], step1[11]);
2003
+ step2[7] = vec_mergel(step1[3], step1[11]);
2004
+ step2[8] = vec_mergeh(step1[4], step1[12]);
2005
+ step2[9] = vec_mergel(step1[4], step1[12]);
2006
+ step2[10] = vec_mergeh(step1[5], step1[13]);
2007
+ step2[11] = vec_mergel(step1[5], step1[13]);
2008
+ step2[12] = vec_mergeh(step1[6], step1[14]);
2009
+ step2[13] = vec_mergel(step1[6], step1[14]);
2010
+ step2[14] = vec_mergeh(step1[7], step1[15]);
2011
+ step2[15] = vec_mergel(step1[7], step1[15]);
2012
+
2013
+ step3[0] = vec_mergeh(step2[0], step2[8]);
2014
+ step3[1] = vec_mergel(step2[0], step2[8]);
2015
+ step3[2] = vec_mergeh(step2[1], step2[9]);
2016
+ step3[3] = vec_mergel(step2[1], step2[9]);
2017
+ step3[4] = vec_mergeh(step2[2], step2[10]);
2018
+ step3[5] = vec_mergel(step2[2], step2[10]);
2019
+ step3[6] = vec_mergeh(step2[3], step2[11]);
2020
+ step3[7] = vec_mergel(step2[3], step2[11]);
2021
+ step3[8] = vec_mergeh(step2[4], step2[12]);
2022
+ step3[9] = vec_mergel(step2[4], step2[12]);
2023
+ step3[10] = vec_mergeh(step2[5], step2[13]);
2024
+ step3[11] = vec_mergel(step2[5], step2[13]);
2025
+ step3[12] = vec_mergeh(step2[6], step2[14]);
2026
+ step3[13] = vec_mergel(step2[6], step2[14]);
2027
+ step3[14] = vec_mergeh(step2[7], step2[15]);
2028
+ step3[15] = vec_mergel(step2[7], step2[15]);
2029
+
2030
+ kernel.packet[0] = vec_mergeh(step3[0], step3[8]);
2031
+ kernel.packet[1] = vec_mergel(step3[0], step3[8]);
2032
+ kernel.packet[2] = vec_mergeh(step3[1], step3[9]);
2033
+ kernel.packet[3] = vec_mergel(step3[1], step3[9]);
2034
+ kernel.packet[4] = vec_mergeh(step3[2], step3[10]);
2035
+ kernel.packet[5] = vec_mergel(step3[2], step3[10]);
2036
+ kernel.packet[6] = vec_mergeh(step3[3], step3[11]);
2037
+ kernel.packet[7] = vec_mergel(step3[3], step3[11]);
2038
+ kernel.packet[8] = vec_mergeh(step3[4], step3[12]);
2039
+ kernel.packet[9] = vec_mergel(step3[4], step3[12]);
2040
+ kernel.packet[10] = vec_mergeh(step3[5], step3[13]);
2041
+ kernel.packet[11] = vec_mergel(step3[5], step3[13]);
2042
+ kernel.packet[12] = vec_mergeh(step3[6], step3[14]);
2043
+ kernel.packet[13] = vec_mergel(step3[6], step3[14]);
2044
+ kernel.packet[14] = vec_mergeh(step3[7], step3[15]);
2045
+ kernel.packet[15] = vec_mergel(step3[7], step3[15]);
2046
+ }
2047
+
2048
+ EIGEN_DEVICE_FUNC inline void
2049
+ ptranspose(PacketBlock<Packet16uc,16>& kernel) {
2050
+ Packet16uc step1[16], step2[16], step3[16];
2051
+
2052
+ step1[0] = vec_mergeh(kernel.packet[0], kernel.packet[8]);
2053
+ step1[1] = vec_mergel(kernel.packet[0], kernel.packet[8]);
2054
+ step1[2] = vec_mergeh(kernel.packet[1], kernel.packet[9]);
2055
+ step1[3] = vec_mergel(kernel.packet[1], kernel.packet[9]);
2056
+ step1[4] = vec_mergeh(kernel.packet[2], kernel.packet[10]);
2057
+ step1[5] = vec_mergel(kernel.packet[2], kernel.packet[10]);
2058
+ step1[6] = vec_mergeh(kernel.packet[3], kernel.packet[11]);
2059
+ step1[7] = vec_mergel(kernel.packet[3], kernel.packet[11]);
2060
+ step1[8] = vec_mergeh(kernel.packet[4], kernel.packet[12]);
2061
+ step1[9] = vec_mergel(kernel.packet[4], kernel.packet[12]);
2062
+ step1[10] = vec_mergeh(kernel.packet[5], kernel.packet[13]);
2063
+ step1[11] = vec_mergel(kernel.packet[5], kernel.packet[13]);
2064
+ step1[12] = vec_mergeh(kernel.packet[6], kernel.packet[14]);
2065
+ step1[13] = vec_mergel(kernel.packet[6], kernel.packet[14]);
2066
+ step1[14] = vec_mergeh(kernel.packet[7], kernel.packet[15]);
2067
+ step1[15] = vec_mergel(kernel.packet[7], kernel.packet[15]);
2068
+
2069
+ step2[0] = vec_mergeh(step1[0], step1[8]);
2070
+ step2[1] = vec_mergel(step1[0], step1[8]);
2071
+ step2[2] = vec_mergeh(step1[1], step1[9]);
2072
+ step2[3] = vec_mergel(step1[1], step1[9]);
2073
+ step2[4] = vec_mergeh(step1[2], step1[10]);
2074
+ step2[5] = vec_mergel(step1[2], step1[10]);
2075
+ step2[6] = vec_mergeh(step1[3], step1[11]);
2076
+ step2[7] = vec_mergel(step1[3], step1[11]);
2077
+ step2[8] = vec_mergeh(step1[4], step1[12]);
2078
+ step2[9] = vec_mergel(step1[4], step1[12]);
2079
+ step2[10] = vec_mergeh(step1[5], step1[13]);
2080
+ step2[11] = vec_mergel(step1[5], step1[13]);
2081
+ step2[12] = vec_mergeh(step1[6], step1[14]);
2082
+ step2[13] = vec_mergel(step1[6], step1[14]);
2083
+ step2[14] = vec_mergeh(step1[7], step1[15]);
2084
+ step2[15] = vec_mergel(step1[7], step1[15]);
2085
+
2086
+ step3[0] = vec_mergeh(step2[0], step2[8]);
2087
+ step3[1] = vec_mergel(step2[0], step2[8]);
2088
+ step3[2] = vec_mergeh(step2[1], step2[9]);
2089
+ step3[3] = vec_mergel(step2[1], step2[9]);
2090
+ step3[4] = vec_mergeh(step2[2], step2[10]);
2091
+ step3[5] = vec_mergel(step2[2], step2[10]);
2092
+ step3[6] = vec_mergeh(step2[3], step2[11]);
2093
+ step3[7] = vec_mergel(step2[3], step2[11]);
2094
+ step3[8] = vec_mergeh(step2[4], step2[12]);
2095
+ step3[9] = vec_mergel(step2[4], step2[12]);
2096
+ step3[10] = vec_mergeh(step2[5], step2[13]);
2097
+ step3[11] = vec_mergel(step2[5], step2[13]);
2098
+ step3[12] = vec_mergeh(step2[6], step2[14]);
2099
+ step3[13] = vec_mergel(step2[6], step2[14]);
2100
+ step3[14] = vec_mergeh(step2[7], step2[15]);
2101
+ step3[15] = vec_mergel(step2[7], step2[15]);
2102
+
2103
+ kernel.packet[0] = vec_mergeh(step3[0], step3[8]);
2104
+ kernel.packet[1] = vec_mergel(step3[0], step3[8]);
2105
+ kernel.packet[2] = vec_mergeh(step3[1], step3[9]);
2106
+ kernel.packet[3] = vec_mergel(step3[1], step3[9]);
2107
+ kernel.packet[4] = vec_mergeh(step3[2], step3[10]);
2108
+ kernel.packet[5] = vec_mergel(step3[2], step3[10]);
2109
+ kernel.packet[6] = vec_mergeh(step3[3], step3[11]);
2110
+ kernel.packet[7] = vec_mergel(step3[3], step3[11]);
2111
+ kernel.packet[8] = vec_mergeh(step3[4], step3[12]);
2112
+ kernel.packet[9] = vec_mergel(step3[4], step3[12]);
2113
+ kernel.packet[10] = vec_mergeh(step3[5], step3[13]);
2114
+ kernel.packet[11] = vec_mergel(step3[5], step3[13]);
2115
+ kernel.packet[12] = vec_mergeh(step3[6], step3[14]);
2116
+ kernel.packet[13] = vec_mergel(step3[6], step3[14]);
2117
+ kernel.packet[14] = vec_mergeh(step3[7], step3[15]);
2118
+ kernel.packet[15] = vec_mergel(step3[7], step3[15]);
2119
+ }
2120
+
2121
+ template<typename Packet> EIGEN_STRONG_INLINE
2122
+ Packet pblend4(const Selector<4>& ifPacket, const Packet& thenPacket, const Packet& elsePacket) {
2123
+ Packet4ui select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3] };
2124
+ Packet4ui mask = reinterpret_cast<Packet4ui>(vec_cmpeq(reinterpret_cast<Packet4ui>(select), reinterpret_cast<Packet4ui>(p4i_ONE)));
2125
+ return vec_sel(elsePacket, thenPacket, mask);
2126
+ }
2127
+
2128
+ template<> EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket, const Packet4i& elsePacket) {
2129
+ return pblend4<Packet4i>(ifPacket, thenPacket, elsePacket);
2130
+ }
2131
+
2132
+ template<> EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, const Packet4f& elsePacket) {
2133
+ return pblend4<Packet4f>(ifPacket, thenPacket, elsePacket);
2134
+ }
2135
+
2136
+ template<> EIGEN_STRONG_INLINE Packet8s pblend(const Selector<8>& ifPacket, const Packet8s& thenPacket, const Packet8s& elsePacket) {
2137
+ Packet8us select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3],
2138
+ ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7] };
2139
+ Packet8us mask = reinterpret_cast<Packet8us>(vec_cmpeq(select, p8us_ONE));
2140
+ Packet8s result = vec_sel(elsePacket, thenPacket, mask);
2141
+ return result;
2142
+ }
2143
+
2144
+ template<> EIGEN_STRONG_INLINE Packet8us pblend(const Selector<8>& ifPacket, const Packet8us& thenPacket, const Packet8us& elsePacket) {
2145
+ Packet8us select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3],
2146
+ ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7] };
2147
+ Packet8us mask = reinterpret_cast<Packet8us>(vec_cmpeq(reinterpret_cast<Packet8us>(select), p8us_ONE));
2148
+ return vec_sel(elsePacket, thenPacket, mask);
2149
+ }
2150
+
2151
+ template<> EIGEN_STRONG_INLINE Packet8bf pblend(const Selector<8>& ifPacket, const Packet8bf& thenPacket, const Packet8bf& elsePacket) {
2152
+ return pblend<Packet8us>(ifPacket, thenPacket, elsePacket);
2153
+ }
2154
+
2155
+ template<> EIGEN_STRONG_INLINE Packet16c pblend(const Selector<16>& ifPacket, const Packet16c& thenPacket, const Packet16c& elsePacket) {
2156
+ Packet16uc select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3],
2157
+ ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7],
2158
+ ifPacket.select[8], ifPacket.select[9], ifPacket.select[10], ifPacket.select[11],
2159
+ ifPacket.select[12], ifPacket.select[13], ifPacket.select[14], ifPacket.select[15] };
2160
+
2161
+ Packet16uc mask = reinterpret_cast<Packet16uc>(vec_cmpeq(reinterpret_cast<Packet16uc>(select), p16uc_ONE));
2162
+ return vec_sel(elsePacket, thenPacket, mask);
2163
+ }
2164
+
2165
+ template<> EIGEN_STRONG_INLINE Packet16uc pblend(const Selector<16>& ifPacket, const Packet16uc& thenPacket, const Packet16uc& elsePacket) {
2166
+ Packet16uc select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3],
2167
+ ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7],
2168
+ ifPacket.select[8], ifPacket.select[9], ifPacket.select[10], ifPacket.select[11],
2169
+ ifPacket.select[12], ifPacket.select[13], ifPacket.select[14], ifPacket.select[15] };
2170
+
2171
+ Packet16uc mask = reinterpret_cast<Packet16uc>(vec_cmpeq(reinterpret_cast<Packet16uc>(select), p16uc_ONE));
2172
+ return vec_sel(elsePacket, thenPacket, mask);
2173
+ }
2174
+
2175
+ template <>
2176
+ struct type_casting_traits<float, int> {
2177
+ enum {
2178
+ VectorizedCast = 1,
2179
+ SrcCoeffRatio = 1,
2180
+ TgtCoeffRatio = 1
2181
+ };
2182
+ };
2183
+
2184
+ template <>
2185
+ struct type_casting_traits<int, float> {
2186
+ enum {
2187
+ VectorizedCast = 1,
2188
+ SrcCoeffRatio = 1,
2189
+ TgtCoeffRatio = 1
2190
+ };
2191
+ };
2192
+
2193
+ template <>
2194
+ struct type_casting_traits<bfloat16, unsigned short int> {
2195
+ enum {
2196
+ VectorizedCast = 1,
2197
+ SrcCoeffRatio = 1,
2198
+ TgtCoeffRatio = 1
2199
+ };
2200
+ };
2201
+
2202
+ template <>
2203
+ struct type_casting_traits<unsigned short int, bfloat16> {
2204
+ enum {
2205
+ VectorizedCast = 1,
2206
+ SrcCoeffRatio = 1,
2207
+ TgtCoeffRatio = 1
2208
+ };
2209
+ };
2210
+
2211
+ template<> EIGEN_STRONG_INLINE Packet4i pcast<Packet4f, Packet4i>(const Packet4f& a) {
2212
+ return vec_cts(a,0);
2213
+ }
2214
+
2215
+ template<> EIGEN_STRONG_INLINE Packet4ui pcast<Packet4f, Packet4ui>(const Packet4f& a) {
2216
+ return vec_ctu(a,0);
2217
+ }
2218
+
2219
+ template<> EIGEN_STRONG_INLINE Packet4f pcast<Packet4i, Packet4f>(const Packet4i& a) {
2220
+ return vec_ctf(a,0);
2221
+ }
2222
+
2223
+ template<> EIGEN_STRONG_INLINE Packet4f pcast<Packet4ui, Packet4f>(const Packet4ui& a) {
2224
+ return vec_ctf(a,0);
2225
+ }
2226
+
2227
+ template<> EIGEN_STRONG_INLINE Packet8us pcast<Packet8bf, Packet8us>(const Packet8bf& a) {
2228
+ Packet4f float_even = Bf16ToF32Even(a);
2229
+ Packet4f float_odd = Bf16ToF32Odd(a);
2230
+ Packet4ui int_even = pcast<Packet4f, Packet4ui>(float_even);
2231
+ Packet4ui int_odd = pcast<Packet4f, Packet4ui>(float_odd);
2232
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(low_mask, 0x0000FFFF);
2233
+ Packet4ui low_even = pand<Packet4ui>(int_even, p4ui_low_mask);
2234
+ Packet4ui low_odd = pand<Packet4ui>(int_odd, p4ui_low_mask);
2235
+
2236
+ //Check values that are bigger than USHRT_MAX (0xFFFF)
2237
+ Packet4bi overflow_selector;
2238
+ if(vec_any_gt(int_even, p4ui_low_mask)){
2239
+ overflow_selector = vec_cmpgt(int_even, p4ui_low_mask);
2240
+ low_even = vec_sel(low_even, p4ui_low_mask, overflow_selector);
2241
+ }
2242
+ if(vec_any_gt(int_odd, p4ui_low_mask)){
2243
+ overflow_selector = vec_cmpgt(int_odd, p4ui_low_mask);
2244
+ low_odd = vec_sel(low_even, p4ui_low_mask, overflow_selector);
2245
+ }
2246
+
2247
+ low_odd = plogical_shift_left<16>(low_odd);
2248
+
2249
+ Packet4ui int_final = por<Packet4ui>(low_even, low_odd);
2250
+ return reinterpret_cast<Packet8us>(int_final);
2251
+ }
2252
+
2253
+ template<> EIGEN_STRONG_INLINE Packet8bf pcast<Packet8us, Packet8bf>(const Packet8us& a) {
2254
+ //short -> int -> float -> bfloat16
2255
+ const _EIGEN_DECLARE_CONST_FAST_Packet4ui(low_mask, 0x0000FFFF);
2256
+ Packet4ui int_cast = reinterpret_cast<Packet4ui>(a);
2257
+ Packet4ui int_even = pand<Packet4ui>(int_cast, p4ui_low_mask);
2258
+ Packet4ui int_odd = plogical_shift_right<16>(int_cast);
2259
+ Packet4f float_even = pcast<Packet4ui, Packet4f>(int_even);
2260
+ Packet4f float_odd = pcast<Packet4ui, Packet4f>(int_odd);
2261
+ return F32ToBf16(float_even, float_odd);
2262
+ }
2263
+
2264
+
2265
+ template<> EIGEN_STRONG_INLINE Packet4i preinterpret<Packet4i,Packet4f>(const Packet4f& a) {
2266
+ return reinterpret_cast<Packet4i>(a);
2267
+ }
2268
+
2269
+ template<> EIGEN_STRONG_INLINE Packet4f preinterpret<Packet4f,Packet4i>(const Packet4i& a) {
2270
+ return reinterpret_cast<Packet4f>(a);
2271
+ }
2272
+
2273
+
2274
+
2275
+ //---------- double ----------
2276
+ #ifdef EIGEN_VECTORIZE_VSX
2277
+ typedef __vector double Packet2d;
2278
+ typedef __vector unsigned long long Packet2ul;
2279
+ typedef __vector long long Packet2l;
2280
+ #if EIGEN_COMP_CLANG
2281
+ typedef Packet2ul Packet2bl;
2282
+ #else
2283
+ typedef __vector __bool long Packet2bl;
2284
+ #endif
2285
+
2286
+ static Packet2l p2l_ONE = { 1, 1 };
2287
+ static Packet2l p2l_ZERO = reinterpret_cast<Packet2l>(p4i_ZERO);
2288
+ static Packet2ul p2ul_SIGN = { 0x8000000000000000ull, 0x8000000000000000ull };
2289
+ static Packet2ul p2ul_PREV0DOT5 = { 0x3FDFFFFFFFFFFFFFull, 0x3FDFFFFFFFFFFFFFull };
2290
+ static Packet2d p2d_ONE = { 1.0, 1.0 };
2291
+ static Packet2d p2d_ZERO = reinterpret_cast<Packet2d>(p4f_ZERO);
2292
+ static Packet2d p2d_MZERO = { numext::bit_cast<double>(0x8000000000000000ull),
2293
+ numext::bit_cast<double>(0x8000000000000000ull) };
2294
+
2295
+ #ifdef _BIG_ENDIAN
2296
+ static Packet2d p2d_COUNTDOWN = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4f>(p2d_ZERO), reinterpret_cast<Packet4f>(p2d_ONE), 8));
2297
+ #else
2298
+ static Packet2d p2d_COUNTDOWN = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4f>(p2d_ONE), reinterpret_cast<Packet4f>(p2d_ZERO), 8));
2299
+ #endif
2300
+
2301
+ template<int index> Packet2d vec_splat_dbl(Packet2d& a)
2302
+ {
2303
+ return vec_splat(a, index);
2304
+ }
2305
+
2306
+ template<> struct packet_traits<double> : default_packet_traits
2307
+ {
2308
+ typedef Packet2d type;
2309
+ typedef Packet2d half;
2310
+ enum {
2311
+ Vectorizable = 1,
2312
+ AlignedOnScalar = 1,
2313
+ size=2,
2314
+ HasHalfPacket = 1,
2315
+
2316
+ HasAdd = 1,
2317
+ HasSub = 1,
2318
+ HasMul = 1,
2319
+ HasDiv = 1,
2320
+ HasMin = 1,
2321
+ HasMax = 1,
2322
+ HasAbs = 1,
2323
+ HasSin = 0,
2324
+ HasCos = 0,
2325
+ HasLog = 0,
2326
+ HasExp = 1,
2327
+ HasSqrt = 1,
2328
+ #if !EIGEN_COMP_CLANG
2329
+ HasRsqrt = 1,
2330
+ #else
2331
+ HasRsqrt = 0,
2332
+ #endif
2333
+ HasRound = 1,
2334
+ HasFloor = 1,
2335
+ HasCeil = 1,
2336
+ HasRint = 1,
2337
+ HasNegate = 1,
2338
+ HasBlend = 1
2339
+ };
2340
+ };
2341
+
2342
+ template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2, alignment=Aligned16, vectorizable=true, masked_load_available=false, masked_store_available=false}; typedef Packet2d half; };
2343
+
2344
+ inline std::ostream & operator <<(std::ostream & s, const Packet2l & v)
2345
+ {
2346
+ union {
2347
+ Packet2l v;
2348
+ int64_t n[2];
2349
+ } vt;
2350
+ vt.v = v;
2351
+ s << vt.n[0] << ", " << vt.n[1];
2352
+ return s;
2353
+ }
2354
+
2355
+ inline std::ostream & operator <<(std::ostream & s, const Packet2d & v)
2356
+ {
2357
+ union {
2358
+ Packet2d v;
2359
+ double n[2];
2360
+ } vt;
2361
+ vt.v = v;
2362
+ s << vt.n[0] << ", " << vt.n[1];
2363
+ return s;
2364
+ }
2365
+
2366
+ // Need to define them first or we get specialization after instantiation errors
2367
+ template<> EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(const double* from)
2368
+ {
2369
+ EIGEN_DEBUG_ALIGNED_LOAD
2370
+ return vec_xl(0, const_cast<double *>(from)); // cast needed by Clang
2371
+ }
2372
+
2373
+ template<> EIGEN_STRONG_INLINE void pstore<double>(double* to, const Packet2d& from)
2374
+ {
2375
+ EIGEN_DEBUG_ALIGNED_STORE
2376
+ vec_xst(from, 0, to);
2377
+ }
2378
+
2379
+ template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) {
2380
+ Packet2d v = {from, from};
2381
+ return v;
2382
+ }
2383
+
2384
+ template<> EIGEN_STRONG_INLINE Packet2d pset1frombits<Packet2d>(unsigned long from) {
2385
+ Packet2l v = {static_cast<long long>(from), static_cast<long long>(from)};
2386
+ return reinterpret_cast<Packet2d>(v);
2387
+ }
2388
+
2389
+ template<> EIGEN_STRONG_INLINE void
2390
+ pbroadcast4<Packet2d>(const double *a,
2391
+ Packet2d& a0, Packet2d& a1, Packet2d& a2, Packet2d& a3)
2392
+ {
2393
+ //This way is faster than vec_splat (at least for doubles in Power 9)
2394
+ a0 = pset1<Packet2d>(a[0]);
2395
+ a1 = pset1<Packet2d>(a[1]);
2396
+ a2 = pset1<Packet2d>(a[2]);
2397
+ a3 = pset1<Packet2d>(a[3]);
2398
+ }
2399
+
2400
+ template<> EIGEN_DEVICE_FUNC inline Packet2d pgather<double, Packet2d>(const double* from, Index stride)
2401
+ {
2402
+ EIGEN_ALIGN16 double af[2];
2403
+ af[0] = from[0*stride];
2404
+ af[1] = from[1*stride];
2405
+ return pload<Packet2d>(af);
2406
+ }
2407
+ template<> EIGEN_DEVICE_FUNC inline void pscatter<double, Packet2d>(double* to, const Packet2d& from, Index stride)
2408
+ {
2409
+ EIGEN_ALIGN16 double af[2];
2410
+ pstore<double>(af, from);
2411
+ to[0*stride] = af[0];
2412
+ to[1*stride] = af[1];
2413
+ }
2414
+
2415
+ template<> EIGEN_STRONG_INLINE Packet2d plset<Packet2d>(const double& a) { return pset1<Packet2d>(a) + p2d_COUNTDOWN; }
2416
+
2417
+ template<> EIGEN_STRONG_INLINE Packet2d padd<Packet2d>(const Packet2d& a, const Packet2d& b) { return a + b; }
2418
+
2419
+ template<> EIGEN_STRONG_INLINE Packet2d psub<Packet2d>(const Packet2d& a, const Packet2d& b) { return a - b; }
2420
+
2421
+ template<> EIGEN_STRONG_INLINE Packet2d pnegate(const Packet2d& a)
2422
+ {
2423
+ #ifdef __POWER8_VECTOR__
2424
+ return vec_neg(a);
2425
+ #else
2426
+ return vec_xor(a, p2d_MZERO);
2427
+ #endif
2428
+ }
2429
+
2430
+ template<> EIGEN_STRONG_INLINE Packet2d pconj(const Packet2d& a) { return a; }
2431
+
2432
+ template<> EIGEN_STRONG_INLINE Packet2d pmul<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_madd(a,b,p2d_MZERO); }
2433
+ template<> EIGEN_STRONG_INLINE Packet2d pdiv<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_div(a,b); }
2434
+
2435
+ // for some weird raisons, it has to be overloaded for packet of integers
2436
+ template<> EIGEN_STRONG_INLINE Packet2d pmadd(const Packet2d& a, const Packet2d& b, const Packet2d& c) { return vec_madd(a, b, c); }
2437
+
2438
+ template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b)
2439
+ {
2440
+ // NOTE: about 10% slower than vec_min, but consistent with std::min and SSE regarding NaN
2441
+ Packet2d ret;
2442
+ __asm__ ("xvcmpgedp %x0,%x1,%x2\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));
2443
+ return ret;
2444
+ }
2445
+
2446
+ template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b)
2447
+ {
2448
+ // NOTE: about 10% slower than vec_max, but consistent with std::max and SSE regarding NaN
2449
+ Packet2d ret;
2450
+ __asm__ ("xvcmpgtdp %x0,%x2,%x1\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));
2451
+ return ret;
2452
+ }
2453
+
2454
+ template<> EIGEN_STRONG_INLINE Packet2d pcmp_le(const Packet2d& a, const Packet2d& b) { return reinterpret_cast<Packet2d>(vec_cmple(a,b)); }
2455
+ template<> EIGEN_STRONG_INLINE Packet2d pcmp_lt(const Packet2d& a, const Packet2d& b) { return reinterpret_cast<Packet2d>(vec_cmplt(a,b)); }
2456
+ template<> EIGEN_STRONG_INLINE Packet2d pcmp_eq(const Packet2d& a, const Packet2d& b) { return reinterpret_cast<Packet2d>(vec_cmpeq(a,b)); }
2457
+ template<> EIGEN_STRONG_INLINE Packet2d pcmp_lt_or_nan(const Packet2d& a, const Packet2d& b) {
2458
+ Packet2d c = reinterpret_cast<Packet2d>(vec_cmpge(a,b));
2459
+ return vec_nor(c,c);
2460
+ }
2461
+
2462
+ template<> EIGEN_STRONG_INLINE Packet2d pand<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_and(a, b); }
2463
+
2464
+ template<> EIGEN_STRONG_INLINE Packet2d por<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_or(a, b); }
2465
+
2466
+ template<> EIGEN_STRONG_INLINE Packet2d pxor<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_xor(a, b); }
2467
+
2468
+ template<> EIGEN_STRONG_INLINE Packet2d pandnot<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_and(a, vec_nor(b, b)); }
2469
+
2470
+ template<> EIGEN_STRONG_INLINE Packet2d pround<Packet2d>(const Packet2d& a)
2471
+ {
2472
+ Packet2d t = vec_add(reinterpret_cast<Packet2d>(vec_or(vec_and(reinterpret_cast<Packet2ul>(a), p2ul_SIGN), p2ul_PREV0DOT5)), a);
2473
+ Packet2d res;
2474
+
2475
+ __asm__("xvrdpiz %x0, %x1\n\t"
2476
+ : "=&wa" (res)
2477
+ : "wa" (t));
2478
+
2479
+ return res;
2480
+ }
2481
+ template<> EIGEN_STRONG_INLINE Packet2d pceil<Packet2d>(const Packet2d& a) { return vec_ceil(a); }
2482
+ template<> EIGEN_STRONG_INLINE Packet2d pfloor<Packet2d>(const Packet2d& a) { return vec_floor(a); }
2483
+ template<> EIGEN_STRONG_INLINE Packet2d print<Packet2d>(const Packet2d& a)
2484
+ {
2485
+ Packet2d res;
2486
+
2487
+ __asm__("xvrdpic %x0, %x1\n\t"
2488
+ : "=&wa" (res)
2489
+ : "wa" (a));
2490
+
2491
+ return res;
2492
+ }
2493
+
2494
+ template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double* from)
2495
+ {
2496
+ EIGEN_DEBUG_UNALIGNED_LOAD
2497
+ return vec_xl(0, const_cast<double*>(from));
2498
+ }
2499
+
2500
+ template<> EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double* from)
2501
+ {
2502
+ Packet2d p;
2503
+ if((std::ptrdiff_t(from) % 16) == 0) p = pload<Packet2d>(from);
2504
+ else p = ploadu<Packet2d>(from);
2505
+ return vec_splat_dbl<0>(p);
2506
+ }
2507
+
2508
+ template<> EIGEN_STRONG_INLINE void pstoreu<double>(double* to, const Packet2d& from)
2509
+ {
2510
+ EIGEN_DEBUG_UNALIGNED_STORE
2511
+ vec_xst(from, 0, to);
2512
+ }
2513
+
2514
+ template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { EIGEN_PPC_PREFETCH(addr); }
2515
+
2516
+ template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { EIGEN_ALIGN16 double x[2]; pstore<double>(x, a); return x[0]; }
2517
+
2518
+ template<> EIGEN_STRONG_INLINE Packet2d preverse(const Packet2d& a)
2519
+ {
2520
+ return reinterpret_cast<Packet2d>(vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE64));
2521
+ }
2522
+ template<> EIGEN_STRONG_INLINE Packet2d pabs(const Packet2d& a) { return vec_abs(a); }
2523
+
2524
+ // VSX support varies between different compilers and even different
2525
+ // versions of the same compiler. For gcc version >= 4.9.3, we can use
2526
+ // vec_cts to efficiently convert Packet2d to Packet2l. Otherwise, use
2527
+ // a slow version that works with older compilers.
2528
+ // Update: apparently vec_cts/vec_ctf intrinsics for 64-bit doubles
2529
+ // are buggy, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70963
2530
+ template<>
2531
+ inline Packet2l pcast<Packet2d, Packet2l>(const Packet2d& x) {
2532
+ #if EIGEN_GNUC_AT_LEAST(5, 4) || \
2533
+ (EIGEN_GNUC_AT(6, 1) && __GNUC_PATCHLEVEL__ >= 1)
2534
+ return vec_cts(x, 0); // TODO: check clang version.
2535
+ #else
2536
+ double tmp[2];
2537
+ memcpy(tmp, &x, sizeof(tmp));
2538
+ Packet2l l = { static_cast<long long>(tmp[0]),
2539
+ static_cast<long long>(tmp[1]) };
2540
+ return l;
2541
+ #endif
2542
+ }
2543
+
2544
+ template<>
2545
+ inline Packet2d pcast<Packet2l, Packet2d>(const Packet2l& x) {
2546
+ unsigned long long tmp[2];
2547
+ memcpy(tmp, &x, sizeof(tmp));
2548
+ Packet2d d = { static_cast<double>(tmp[0]),
2549
+ static_cast<double>(tmp[1]) };
2550
+ return d;
2551
+ }
2552
+
2553
+
2554
+ // Packet2l shifts.
2555
+ // For POWER8 we simply use vec_sr/l.
2556
+ //
2557
+ // Things are more complicated for POWER7. There is actually a
2558
+ // vec_xxsxdi intrinsic but it is not supported by some gcc versions.
2559
+ // So we need to shift by N % 32 and rearrage bytes.
2560
+ #ifdef __POWER8_VECTOR__
2561
+
2562
+ template<int N>
2563
+ EIGEN_STRONG_INLINE Packet2l plogical_shift_left(const Packet2l& a) {
2564
+ const Packet2ul shift = { N, N };
2565
+ return vec_sl(a, shift);
2566
+ }
2567
+
2568
+ template<int N>
2569
+ EIGEN_STRONG_INLINE Packet2l plogical_shift_right(const Packet2l& a) {
2570
+ const Packet2ul shift = { N, N };
2571
+ return vec_sr(a, shift);
2572
+ }
2573
+
2574
+ #else
2575
+
2576
+ // Shifts [A, B, C, D] to [B, 0, D, 0].
2577
+ // Used to implement left shifts for Packet2l.
2578
+ EIGEN_ALWAYS_INLINE Packet4i shift_even_left(const Packet4i& a) {
2579
+ static const Packet16uc perm = {
2580
+ 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03,
2581
+ 0x1c, 0x1d, 0x1e, 0x1f, 0x08, 0x09, 0x0a, 0x0b };
2582
+ #ifdef _BIG_ENDIAN
2583
+ return vec_perm(p4i_ZERO, a, perm);
2584
+ #else
2585
+ return vec_perm(a, p4i_ZERO, perm);
2586
+ #endif
2587
+ }
2588
+
2589
+ // Shifts [A, B, C, D] to [0, A, 0, C].
2590
+ // Used to implement right shifts for Packet2l.
2591
+ EIGEN_ALWAYS_INLINE Packet4i shift_odd_right(const Packet4i& a) {
2592
+ static const Packet16uc perm = {
2593
+ 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
2594
+ 0x0c, 0x0d, 0x0e, 0x0f, 0x18, 0x19, 0x1a, 0x1b };
2595
+ #ifdef _BIG_ENDIAN
2596
+ return vec_perm(p4i_ZERO, a, perm);
2597
+ #else
2598
+ return vec_perm(a, p4i_ZERO, perm);
2599
+ #endif
2600
+ }
2601
+
2602
+ template<int N, typename EnableIf = void>
2603
+ struct plogical_shift_left_impl;
2604
+
2605
+ template<int N>
2606
+ struct plogical_shift_left_impl<N, typename enable_if<(N < 32) && (N >= 0)>::type> {
2607
+ static EIGEN_STRONG_INLINE Packet2l run(const Packet2l& a) {
2608
+ static const unsigned n = static_cast<unsigned>(N);
2609
+ const Packet4ui shift = {n, n, n, n};
2610
+ const Packet4i ai = reinterpret_cast<Packet4i>(a);
2611
+ static const unsigned m = static_cast<unsigned>(32 - N);
2612
+ const Packet4ui shift_right = {m, m, m, m};
2613
+ const Packet4i out_hi = vec_sl(ai, shift);
2614
+ const Packet4i out_lo = shift_even_left(vec_sr(ai, shift_right));
2615
+ return reinterpret_cast<Packet2l>(por<Packet4i>(out_hi, out_lo));
2616
+ }
2617
+ };
2618
+
2619
+ template<int N>
2620
+ struct plogical_shift_left_impl<N, typename enable_if<(N >= 32)>::type> {
2621
+ static EIGEN_STRONG_INLINE Packet2l run(const Packet2l& a) {
2622
+ static const unsigned m = static_cast<unsigned>(N - 32);
2623
+ const Packet4ui shift = {m, m, m, m};
2624
+ const Packet4i ai = reinterpret_cast<Packet4i>(a);
2625
+ return reinterpret_cast<Packet2l>(shift_even_left(vec_sl(ai, shift)));
2626
+ }
2627
+ };
2628
+
2629
+ template<int N>
2630
+ EIGEN_STRONG_INLINE Packet2l plogical_shift_left(const Packet2l& a) {
2631
+ return plogical_shift_left_impl<N>::run(a);
2632
+ }
2633
+
2634
+ template<int N, typename EnableIf = void>
2635
+ struct plogical_shift_right_impl;
2636
+
2637
+ template<int N>
2638
+ struct plogical_shift_right_impl<N, typename enable_if<(N < 32) && (N >= 0)>::type> {
2639
+ static EIGEN_STRONG_INLINE Packet2l run(const Packet2l& a) {
2640
+ static const unsigned n = static_cast<unsigned>(N);
2641
+ const Packet4ui shift = {n, n, n, n};
2642
+ const Packet4i ai = reinterpret_cast<Packet4i>(a);
2643
+ static const unsigned m = static_cast<unsigned>(32 - N);
2644
+ const Packet4ui shift_left = {m, m, m, m};
2645
+ const Packet4i out_lo = vec_sr(ai, shift);
2646
+ const Packet4i out_hi = shift_odd_right(vec_sl(ai, shift_left));
2647
+ return reinterpret_cast<Packet2l>(por<Packet4i>(out_hi, out_lo));
2648
+ }
2649
+ };
2650
+
2651
+ template<int N>
2652
+ struct plogical_shift_right_impl<N, typename enable_if<(N >= 32)>::type> {
2653
+ static EIGEN_STRONG_INLINE Packet2l run(const Packet2l& a) {
2654
+ static const unsigned m = static_cast<unsigned>(N - 32);
2655
+ const Packet4ui shift = {m, m, m, m};
2656
+ const Packet4i ai = reinterpret_cast<Packet4i>(a);
2657
+ return reinterpret_cast<Packet2l>(shift_odd_right(vec_sr(ai, shift)));
2658
+ }
2659
+ };
2660
+
2661
+ template<int N>
2662
+ EIGEN_STRONG_INLINE Packet2l plogical_shift_right(const Packet2l& a) {
2663
+ return plogical_shift_right_impl<N>::run(a);
2664
+ }
2665
+ #endif
2666
+
2667
+ template<> EIGEN_STRONG_INLINE Packet2d pldexp<Packet2d>(const Packet2d& a, const Packet2d& exponent) {
2668
+ // Clamp exponent to [-2099, 2099]
2669
+ const Packet2d max_exponent = pset1<Packet2d>(2099.0);
2670
+ const Packet2l e = pcast<Packet2d, Packet2l>(pmin(pmax(exponent, pnegate(max_exponent)), max_exponent));
2671
+
2672
+ // Split 2^e into four factors and multiply:
2673
+ const Packet2l bias = { 1023, 1023 };
2674
+ Packet2l b = plogical_shift_right<2>(e); // floor(e/4)
2675
+ Packet2d c = reinterpret_cast<Packet2d>(plogical_shift_left<52>(b + bias));
2676
+ Packet2d out = pmul(pmul(pmul(a, c), c), c); // a * 2^(3b)
2677
+ b = psub(psub(psub(e, b), b), b); // e - 3b
2678
+ c = reinterpret_cast<Packet2d>(plogical_shift_left<52>(b + bias)); // 2^(e - 3b)
2679
+ out = pmul(out, c); // a * 2^e
2680
+ return out;
2681
+ }
2682
+
2683
+
2684
+ // Extract exponent without existence of Packet2l.
2685
+ template<>
2686
+ EIGEN_STRONG_INLINE
2687
+ Packet2d pfrexp_generic_get_biased_exponent(const Packet2d& a) {
2688
+ return pcast<Packet2l, Packet2d>(plogical_shift_right<52>(reinterpret_cast<Packet2l>(pabs(a))));
2689
+ }
2690
+
2691
+ template<> EIGEN_STRONG_INLINE Packet2d pfrexp<Packet2d> (const Packet2d& a, Packet2d& exponent) {
2692
+ return pfrexp_generic(a, exponent);
2693
+ }
2694
+
2695
+ template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a)
2696
+ {
2697
+ Packet2d b, sum;
2698
+ b = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4f>(a), reinterpret_cast<Packet4f>(a), 8));
2699
+ sum = a + b;
2700
+ return pfirst<Packet2d>(sum);
2701
+ }
2702
+
2703
+ // Other reduction functions:
2704
+ // mul
2705
+ template<> EIGEN_STRONG_INLINE double predux_mul<Packet2d>(const Packet2d& a)
2706
+ {
2707
+ return pfirst(pmul(a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4ui>(a), reinterpret_cast<Packet4ui>(a), 8))));
2708
+ }
2709
+
2710
+ // min
2711
+ template<> EIGEN_STRONG_INLINE double predux_min<Packet2d>(const Packet2d& a)
2712
+ {
2713
+ return pfirst(pmin(a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4ui>(a), reinterpret_cast<Packet4ui>(a), 8))));
2714
+ }
2715
+
2716
+ // max
2717
+ template<> EIGEN_STRONG_INLINE double predux_max<Packet2d>(const Packet2d& a)
2718
+ {
2719
+ return pfirst(pmax(a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4ui>(a), reinterpret_cast<Packet4ui>(a), 8))));
2720
+ }
2721
+
2722
+ EIGEN_DEVICE_FUNC inline void
2723
+ ptranspose(PacketBlock<Packet2d,2>& kernel) {
2724
+ Packet2d t0, t1;
2725
+ t0 = vec_perm(kernel.packet[0], kernel.packet[1], p16uc_TRANSPOSE64_HI);
2726
+ t1 = vec_perm(kernel.packet[0], kernel.packet[1], p16uc_TRANSPOSE64_LO);
2727
+ kernel.packet[0] = t0;
2728
+ kernel.packet[1] = t1;
2729
+ }
2730
+
2731
+ template<> EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, const Packet2d& elsePacket) {
2732
+ Packet2l select = { ifPacket.select[0], ifPacket.select[1] };
2733
+ Packet2bl mask = reinterpret_cast<Packet2bl>( vec_cmpeq(reinterpret_cast<Packet2d>(select), reinterpret_cast<Packet2d>(p2l_ONE)) );
2734
+ return vec_sel(elsePacket, thenPacket, mask);
2735
+ }
2736
+
2737
+
2738
+ #endif // EIGEN_VECTORIZE_VSX
2739
+ } // end namespace internal
2740
+
2741
+ } // end namespace Eigen
2742
+
2743
+ #endif // EIGEN_PACKET_MATH_ALTIVEC_H