ruby-eigen 0.0.9 → 0.0.10.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (293) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +22 -0
  3. data/README.md +21 -0
  4. data/ext/eigen/eigen3/COPYING.BSD +26 -0
  5. data/ext/eigen/eigen3/COPYING.MPL2 +373 -0
  6. data/ext/eigen/eigen3/COPYING.README +18 -0
  7. data/ext/eigen/eigen3/Eigen/Array +11 -0
  8. data/ext/eigen/eigen3/Eigen/Cholesky +32 -0
  9. data/ext/eigen/eigen3/Eigen/CholmodSupport +45 -0
  10. data/ext/eigen/eigen3/Eigen/Core +376 -0
  11. data/ext/eigen/eigen3/Eigen/Dense +7 -0
  12. data/ext/eigen/eigen3/Eigen/Eigen +2 -0
  13. data/ext/eigen/eigen3/Eigen/Eigen2Support +95 -0
  14. data/ext/eigen/eigen3/Eigen/Eigenvalues +48 -0
  15. data/ext/eigen/eigen3/Eigen/Geometry +63 -0
  16. data/ext/eigen/eigen3/Eigen/Householder +23 -0
  17. data/ext/eigen/eigen3/Eigen/IterativeLinearSolvers +40 -0
  18. data/ext/eigen/eigen3/Eigen/Jacobi +26 -0
  19. data/ext/eigen/eigen3/Eigen/LU +41 -0
  20. data/ext/eigen/eigen3/Eigen/LeastSquares +32 -0
  21. data/ext/eigen/eigen3/Eigen/MetisSupport +28 -0
  22. data/ext/eigen/eigen3/Eigen/PaStiXSupport +46 -0
  23. data/ext/eigen/eigen3/Eigen/PardisoSupport +30 -0
  24. data/ext/eigen/eigen3/Eigen/QR +45 -0
  25. data/ext/eigen/eigen3/Eigen/QtAlignedMalloc +34 -0
  26. data/ext/eigen/eigen3/Eigen/SPQRSupport +29 -0
  27. data/ext/eigen/eigen3/Eigen/SVD +37 -0
  28. data/ext/eigen/eigen3/Eigen/Sparse +27 -0
  29. data/ext/eigen/eigen3/Eigen/SparseCore +64 -0
  30. data/ext/eigen/eigen3/Eigen/SparseLU +49 -0
  31. data/ext/eigen/eigen3/Eigen/SparseQR +33 -0
  32. data/ext/eigen/eigen3/Eigen/StdDeque +27 -0
  33. data/ext/eigen/eigen3/Eigen/StdList +26 -0
  34. data/ext/eigen/eigen3/Eigen/StdVector +27 -0
  35. data/ext/eigen/eigen3/Eigen/SuperLUSupport +59 -0
  36. data/ext/eigen/eigen3/Eigen/UmfPackSupport +36 -0
  37. data/ext/eigen/eigen3/Eigen/src/Cholesky/LDLT.h +611 -0
  38. data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT.h +498 -0
  39. data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT_MKL.h +102 -0
  40. data/ext/eigen/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +607 -0
  41. data/ext/eigen/eigen3/Eigen/src/Core/Array.h +323 -0
  42. data/ext/eigen/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
  43. data/ext/eigen/eigen3/Eigen/src/Core/ArrayWrapper.h +264 -0
  44. data/ext/eigen/eigen3/Eigen/src/Core/Assign.h +590 -0
  45. data/ext/eigen/eigen3/Eigen/src/Core/Assign_MKL.h +224 -0
  46. data/ext/eigen/eigen3/Eigen/src/Core/BandMatrix.h +334 -0
  47. data/ext/eigen/eigen3/Eigen/src/Core/Block.h +406 -0
  48. data/ext/eigen/eigen3/Eigen/src/Core/BooleanRedux.h +154 -0
  49. data/ext/eigen/eigen3/Eigen/src/Core/CommaInitializer.h +154 -0
  50. data/ext/eigen/eigen3/Eigen/src/Core/CoreIterators.h +61 -0
  51. data/ext/eigen/eigen3/Eigen/src/Core/CwiseBinaryOp.h +230 -0
  52. data/ext/eigen/eigen3/Eigen/src/Core/CwiseNullaryOp.h +864 -0
  53. data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryOp.h +126 -0
  54. data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryView.h +139 -0
  55. data/ext/eigen/eigen3/Eigen/src/Core/DenseBase.h +521 -0
  56. data/ext/eigen/eigen3/Eigen/src/Core/DenseCoeffsBase.h +754 -0
  57. data/ext/eigen/eigen3/Eigen/src/Core/DenseStorage.h +434 -0
  58. data/ext/eigen/eigen3/Eigen/src/Core/Diagonal.h +237 -0
  59. data/ext/eigen/eigen3/Eigen/src/Core/DiagonalMatrix.h +313 -0
  60. data/ext/eigen/eigen3/Eigen/src/Core/DiagonalProduct.h +131 -0
  61. data/ext/eigen/eigen3/Eigen/src/Core/Dot.h +263 -0
  62. data/ext/eigen/eigen3/Eigen/src/Core/EigenBase.h +131 -0
  63. data/ext/eigen/eigen3/Eigen/src/Core/Flagged.h +140 -0
  64. data/ext/eigen/eigen3/Eigen/src/Core/ForceAlignedAccess.h +146 -0
  65. data/ext/eigen/eigen3/Eigen/src/Core/Functors.h +1026 -0
  66. data/ext/eigen/eigen3/Eigen/src/Core/Fuzzy.h +150 -0
  67. data/ext/eigen/eigen3/Eigen/src/Core/GeneralProduct.h +635 -0
  68. data/ext/eigen/eigen3/Eigen/src/Core/GenericPacketMath.h +350 -0
  69. data/ext/eigen/eigen3/Eigen/src/Core/GlobalFunctions.h +92 -0
  70. data/ext/eigen/eigen3/Eigen/src/Core/IO.h +250 -0
  71. data/ext/eigen/eigen3/Eigen/src/Core/Map.h +192 -0
  72. data/ext/eigen/eigen3/Eigen/src/Core/MapBase.h +247 -0
  73. data/ext/eigen/eigen3/Eigen/src/Core/MathFunctions.h +768 -0
  74. data/ext/eigen/eigen3/Eigen/src/Core/Matrix.h +420 -0
  75. data/ext/eigen/eigen3/Eigen/src/Core/MatrixBase.h +563 -0
  76. data/ext/eigen/eigen3/Eigen/src/Core/NestByValue.h +111 -0
  77. data/ext/eigen/eigen3/Eigen/src/Core/NoAlias.h +134 -0
  78. data/ext/eigen/eigen3/Eigen/src/Core/NumTraits.h +150 -0
  79. data/ext/eigen/eigen3/Eigen/src/Core/PermutationMatrix.h +721 -0
  80. data/ext/eigen/eigen3/Eigen/src/Core/PlainObjectBase.h +822 -0
  81. data/ext/eigen/eigen3/Eigen/src/Core/ProductBase.h +290 -0
  82. data/ext/eigen/eigen3/Eigen/src/Core/Random.h +152 -0
  83. data/ext/eigen/eigen3/Eigen/src/Core/Redux.h +409 -0
  84. data/ext/eigen/eigen3/Eigen/src/Core/Ref.h +278 -0
  85. data/ext/eigen/eigen3/Eigen/src/Core/Replicate.h +177 -0
  86. data/ext/eigen/eigen3/Eigen/src/Core/ReturnByValue.h +99 -0
  87. data/ext/eigen/eigen3/Eigen/src/Core/Reverse.h +224 -0
  88. data/ext/eigen/eigen3/Eigen/src/Core/Select.h +162 -0
  89. data/ext/eigen/eigen3/Eigen/src/Core/SelfAdjointView.h +314 -0
  90. data/ext/eigen/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +191 -0
  91. data/ext/eigen/eigen3/Eigen/src/Core/SolveTriangular.h +260 -0
  92. data/ext/eigen/eigen3/Eigen/src/Core/StableNorm.h +203 -0
  93. data/ext/eigen/eigen3/Eigen/src/Core/Stride.h +108 -0
  94. data/ext/eigen/eigen3/Eigen/src/Core/Swap.h +126 -0
  95. data/ext/eigen/eigen3/Eigen/src/Core/Transpose.h +419 -0
  96. data/ext/eigen/eigen3/Eigen/src/Core/Transpositions.h +436 -0
  97. data/ext/eigen/eigen3/Eigen/src/Core/TriangularMatrix.h +839 -0
  98. data/ext/eigen/eigen3/Eigen/src/Core/VectorBlock.h +95 -0
  99. data/ext/eigen/eigen3/Eigen/src/Core/VectorwiseOp.h +642 -0
  100. data/ext/eigen/eigen3/Eigen/src/Core/Visitor.h +237 -0
  101. data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +217 -0
  102. data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +501 -0
  103. data/ext/eigen/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
  104. data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/Complex.h +253 -0
  105. data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +420 -0
  106. data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/Complex.h +442 -0
  107. data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +475 -0
  108. data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +649 -0
  109. data/ext/eigen/eigen3/Eigen/src/Core/products/CoeffBasedProduct.h +476 -0
  110. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1341 -0
  111. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +427 -0
  112. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +278 -0
  113. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h +146 -0
  114. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h +118 -0
  115. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +566 -0
  116. data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h +131 -0
  117. data/ext/eigen/eigen3/Eigen/src/Core/products/Parallelizer.h +162 -0
  118. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +436 -0
  119. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h +295 -0
  120. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +281 -0
  121. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h +114 -0
  122. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +123 -0
  123. data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
  124. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +427 -0
  125. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h +309 -0
  126. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +348 -0
  127. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h +247 -0
  128. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +332 -0
  129. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h +155 -0
  130. data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +139 -0
  131. data/ext/eigen/eigen3/Eigen/src/Core/util/BlasUtil.h +264 -0
  132. data/ext/eigen/eigen3/Eigen/src/Core/util/Constants.h +451 -0
  133. data/ext/eigen/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +40 -0
  134. data/ext/eigen/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
  135. data/ext/eigen/eigen3/Eigen/src/Core/util/MKL_support.h +158 -0
  136. data/ext/eigen/eigen3/Eigen/src/Core/util/Macros.h +451 -0
  137. data/ext/eigen/eigen3/Eigen/src/Core/util/Memory.h +977 -0
  138. data/ext/eigen/eigen3/Eigen/src/Core/util/Meta.h +243 -0
  139. data/ext/eigen/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
  140. data/ext/eigen/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +14 -0
  141. data/ext/eigen/eigen3/Eigen/src/Core/util/StaticAssert.h +208 -0
  142. data/ext/eigen/eigen3/Eigen/src/Core/util/XprHelper.h +469 -0
  143. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Block.h +126 -0
  144. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Cwise.h +192 -0
  145. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/CwiseOperators.h +298 -0
  146. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h +159 -0
  147. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/All.h +115 -0
  148. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h +214 -0
  149. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h +254 -0
  150. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h +141 -0
  151. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h +495 -0
  152. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h +145 -0
  153. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h +123 -0
  154. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h +167 -0
  155. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h +786 -0
  156. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h +184 -0
  157. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LU.h +120 -0
  158. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Lazy.h +71 -0
  159. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LeastSquares.h +169 -0
  160. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Macros.h +20 -0
  161. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/MathFunctions.h +57 -0
  162. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Memory.h +45 -0
  163. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Meta.h +75 -0
  164. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Minor.h +117 -0
  165. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/QR.h +67 -0
  166. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/SVD.h +637 -0
  167. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/TriangularSolver.h +42 -0
  168. data/ext/eigen/eigen3/Eigen/src/Eigen2Support/VectorBlock.h +94 -0
  169. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +341 -0
  170. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +456 -0
  171. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h +94 -0
  172. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +607 -0
  173. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +350 -0
  174. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +227 -0
  175. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +373 -0
  176. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +160 -0
  177. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealQZ.h +624 -0
  178. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur.h +525 -0
  179. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h +83 -0
  180. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +801 -0
  181. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h +92 -0
  182. data/ext/eigen/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +557 -0
  183. data/ext/eigen/eigen3/Eigen/src/Geometry/AlignedBox.h +392 -0
  184. data/ext/eigen/eigen3/Eigen/src/Geometry/AngleAxis.h +233 -0
  185. data/ext/eigen/eigen3/Eigen/src/Geometry/EulerAngles.h +104 -0
  186. data/ext/eigen/eigen3/Eigen/src/Geometry/Homogeneous.h +307 -0
  187. data/ext/eigen/eigen3/Eigen/src/Geometry/Hyperplane.h +280 -0
  188. data/ext/eigen/eigen3/Eigen/src/Geometry/OrthoMethods.h +218 -0
  189. data/ext/eigen/eigen3/Eigen/src/Geometry/ParametrizedLine.h +195 -0
  190. data/ext/eigen/eigen3/Eigen/src/Geometry/Quaternion.h +776 -0
  191. data/ext/eigen/eigen3/Eigen/src/Geometry/Rotation2D.h +160 -0
  192. data/ext/eigen/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
  193. data/ext/eigen/eigen3/Eigen/src/Geometry/Scaling.h +166 -0
  194. data/ext/eigen/eigen3/Eigen/src/Geometry/Transform.h +1455 -0
  195. data/ext/eigen/eigen3/Eigen/src/Geometry/Translation.h +206 -0
  196. data/ext/eigen/eigen3/Eigen/src/Geometry/Umeyama.h +177 -0
  197. data/ext/eigen/eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h +115 -0
  198. data/ext/eigen/eigen3/Eigen/src/Householder/BlockHouseholder.h +68 -0
  199. data/ext/eigen/eigen3/Eigen/src/Householder/Householder.h +171 -0
  200. data/ext/eigen/eigen3/Eigen/src/Householder/HouseholderSequence.h +441 -0
  201. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -0
  202. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +263 -0
  203. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +256 -0
  204. data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +282 -0
  205. data/ext/eigen/eigen3/Eigen/src/Jacobi/Jacobi.h +433 -0
  206. data/ext/eigen/eigen3/Eigen/src/LU/Determinant.h +101 -0
  207. data/ext/eigen/eigen3/Eigen/src/LU/FullPivLU.h +751 -0
  208. data/ext/eigen/eigen3/Eigen/src/LU/Inverse.h +400 -0
  209. data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU.h +509 -0
  210. data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU_MKL.h +85 -0
  211. data/ext/eigen/eigen3/Eigen/src/LU/arch/Inverse_SSE.h +329 -0
  212. data/ext/eigen/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  213. data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Amd.h +444 -0
  214. data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1850 -0
  215. data/ext/eigen/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +721 -0
  216. data/ext/eigen/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +592 -0
  217. data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +580 -0
  218. data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h +99 -0
  219. data/ext/eigen/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +622 -0
  220. data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR.h +388 -0
  221. data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR_MKL.h +71 -0
  222. data/ext/eigen/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +338 -0
  223. data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD.h +976 -0
  224. data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD_MKL.h +92 -0
  225. data/ext/eigen/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +148 -0
  226. data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +671 -0
  227. data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
  228. data/ext/eigen/eigen3/Eigen/src/SparseCore/AmbiVector.h +373 -0
  229. data/ext/eigen/eigen3/Eigen/src/SparseCore/CompressedStorage.h +233 -0
  230. data/ext/eigen/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +245 -0
  231. data/ext/eigen/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +181 -0
  232. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseBlock.h +537 -0
  233. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  234. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +325 -0
  235. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +163 -0
  236. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +311 -0
  237. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +196 -0
  238. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDot.h +101 -0
  239. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +26 -0
  240. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1262 -0
  241. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +461 -0
  242. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparsePermutation.h +148 -0
  243. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseProduct.h +188 -0
  244. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseRedux.h +45 -0
  245. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +507 -0
  246. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +150 -0
  247. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTranspose.h +63 -0
  248. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +179 -0
  249. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseUtil.h +172 -0
  250. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseVector.h +448 -0
  251. data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseView.h +99 -0
  252. data/ext/eigen/eigen3/Eigen/src/SparseCore/TriangularSolver.h +334 -0
  253. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU.h +806 -0
  254. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  255. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +227 -0
  256. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +111 -0
  257. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +298 -0
  258. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  259. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +180 -0
  260. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +177 -0
  261. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +106 -0
  262. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +279 -0
  263. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +127 -0
  264. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  265. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  266. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  267. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  268. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +135 -0
  269. data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  270. data/ext/eigen/eigen3/Eigen/src/SparseQR/SparseQR.h +714 -0
  271. data/ext/eigen/eigen3/Eigen/src/StlSupport/StdDeque.h +134 -0
  272. data/ext/eigen/eigen3/Eigen/src/StlSupport/StdList.h +114 -0
  273. data/ext/eigen/eigen3/Eigen/src/StlSupport/StdVector.h +126 -0
  274. data/ext/eigen/eigen3/Eigen/src/StlSupport/details.h +84 -0
  275. data/ext/eigen/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1026 -0
  276. data/ext/eigen/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +474 -0
  277. data/ext/eigen/eigen3/Eigen/src/misc/Image.h +84 -0
  278. data/ext/eigen/eigen3/Eigen/src/misc/Kernel.h +81 -0
  279. data/ext/eigen/eigen3/Eigen/src/misc/Solve.h +76 -0
  280. data/ext/eigen/eigen3/Eigen/src/misc/SparseSolve.h +128 -0
  281. data/ext/eigen/eigen3/Eigen/src/misc/blas.h +658 -0
  282. data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +253 -0
  283. data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +187 -0
  284. data/ext/eigen/eigen3/Eigen/src/plugins/BlockMethods.h +935 -0
  285. data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +46 -0
  286. data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +172 -0
  287. data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +143 -0
  288. data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +52 -0
  289. data/ext/eigen/eigen3/signature_of_eigen3_matrix_library +1 -0
  290. data/ext/eigen/eigen_wrap.cxx +19420 -10396
  291. data/ext/eigen/extconf.rb +37 -2
  292. data/lib/eigen.rb +146 -3
  293. metadata +294 -7
@@ -0,0 +1,392 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ //
6
+ // This Source Code Form is subject to the terms of the Mozilla
7
+ // Public License v. 2.0. If a copy of the MPL was not distributed
8
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+
10
+ #ifndef EIGEN_ALIGNEDBOX_H
11
+ #define EIGEN_ALIGNEDBOX_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \geometry_module \ingroup Geometry_Module
16
+ *
17
+ *
18
+ * \class AlignedBox
19
+ *
20
+ * \brief An axis aligned box
21
+ *
22
+ * \tparam _Scalar the type of the scalar coefficients
23
+ * \tparam _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.
24
+ *
25
+ * This class represents an axis aligned box as a pair of the minimal and maximal corners.
26
+ * \warning The result of most methods is undefined when applied to an empty box. You can check for empty boxes using isEmpty().
27
+ * \sa alignedboxtypedefs
28
+ */
29
+ template <typename _Scalar, int _AmbientDim>
30
+ class AlignedBox
31
+ {
32
+ public:
33
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
34
+ enum { AmbientDimAtCompileTime = _AmbientDim };
35
+ typedef _Scalar Scalar;
36
+ typedef NumTraits<Scalar> ScalarTraits;
37
+ typedef DenseIndex Index;
38
+ typedef typename ScalarTraits::Real RealScalar;
39
+ typedef typename ScalarTraits::NonInteger NonInteger;
40
+ typedef Matrix<Scalar,AmbientDimAtCompileTime,1> VectorType;
41
+
42
+ /** Define constants to name the corners of a 1D, 2D or 3D axis aligned bounding box */
43
+ enum CornerType
44
+ {
45
+ /** 1D names @{ */
46
+ Min=0, Max=1,
47
+ /** @} */
48
+
49
+ /** Identifier for 2D corner @{ */
50
+ BottomLeft=0, BottomRight=1,
51
+ TopLeft=2, TopRight=3,
52
+ /** @} */
53
+
54
+ /** Identifier for 3D corner @{ */
55
+ BottomLeftFloor=0, BottomRightFloor=1,
56
+ TopLeftFloor=2, TopRightFloor=3,
57
+ BottomLeftCeil=4, BottomRightCeil=5,
58
+ TopLeftCeil=6, TopRightCeil=7
59
+ /** @} */
60
+ };
61
+
62
+
63
+ /** Default constructor initializing a null box. */
64
+ inline AlignedBox()
65
+ { if (AmbientDimAtCompileTime!=Dynamic) setEmpty(); }
66
+
67
+ /** Constructs a null box with \a _dim the dimension of the ambient space. */
68
+ inline explicit AlignedBox(Index _dim) : m_min(_dim), m_max(_dim)
69
+ { setEmpty(); }
70
+
71
+ /** Constructs a box with extremities \a _min and \a _max.
72
+ * \warning If either component of \a _min is larger than the same component of \a _max, the constructed box is empty. */
73
+ template<typename OtherVectorType1, typename OtherVectorType2>
74
+ inline AlignedBox(const OtherVectorType1& _min, const OtherVectorType2& _max) : m_min(_min), m_max(_max) {}
75
+
76
+ /** Constructs a box containing a single point \a p. */
77
+ template<typename Derived>
78
+ inline explicit AlignedBox(const MatrixBase<Derived>& p) : m_min(p), m_max(m_min)
79
+ { }
80
+
81
+ ~AlignedBox() {}
82
+
83
+ /** \returns the dimension in which the box holds */
84
+ inline Index dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size() : Index(AmbientDimAtCompileTime); }
85
+
86
+ /** \deprecated use isEmpty() */
87
+ inline bool isNull() const { return isEmpty(); }
88
+
89
+ /** \deprecated use setEmpty() */
90
+ inline void setNull() { setEmpty(); }
91
+
92
+ /** \returns true if the box is empty.
93
+ * \sa setEmpty */
94
+ inline bool isEmpty() const { return (m_min.array() > m_max.array()).any(); }
95
+
96
+ /** Makes \c *this an empty box.
97
+ * \sa isEmpty */
98
+ inline void setEmpty()
99
+ {
100
+ m_min.setConstant( ScalarTraits::highest() );
101
+ m_max.setConstant( ScalarTraits::lowest() );
102
+ }
103
+
104
+ /** \returns the minimal corner */
105
+ inline const VectorType& (min)() const { return m_min; }
106
+ /** \returns a non const reference to the minimal corner */
107
+ inline VectorType& (min)() { return m_min; }
108
+ /** \returns the maximal corner */
109
+ inline const VectorType& (max)() const { return m_max; }
110
+ /** \returns a non const reference to the maximal corner */
111
+ inline VectorType& (max)() { return m_max; }
112
+
113
+ /** \returns the center of the box */
114
+ inline const CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>,
115
+ const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const VectorType, const VectorType> >
116
+ center() const
117
+ { return (m_min+m_max)/2; }
118
+
119
+ /** \returns the lengths of the sides of the bounding box.
120
+ * Note that this function does not get the same
121
+ * result for integral or floating scalar types: see
122
+ */
123
+ inline const CwiseBinaryOp< internal::scalar_difference_op<Scalar>, const VectorType, const VectorType> sizes() const
124
+ { return m_max - m_min; }
125
+
126
+ /** \returns the volume of the bounding box */
127
+ inline Scalar volume() const
128
+ { return sizes().prod(); }
129
+
130
+ /** \returns an expression for the bounding box diagonal vector
131
+ * if the length of the diagonal is needed: diagonal().norm()
132
+ * will provide it.
133
+ */
134
+ inline CwiseBinaryOp< internal::scalar_difference_op<Scalar>, const VectorType, const VectorType> diagonal() const
135
+ { return sizes(); }
136
+
137
+ /** \returns the vertex of the bounding box at the corner defined by
138
+ * the corner-id corner. It works only for a 1D, 2D or 3D bounding box.
139
+ * For 1D bounding boxes corners are named by 2 enum constants:
140
+ * BottomLeft and BottomRight.
141
+ * For 2D bounding boxes, corners are named by 4 enum constants:
142
+ * BottomLeft, BottomRight, TopLeft, TopRight.
143
+ * For 3D bounding boxes, the following names are added:
144
+ * BottomLeftCeil, BottomRightCeil, TopLeftCeil, TopRightCeil.
145
+ */
146
+ inline VectorType corner(CornerType corner) const
147
+ {
148
+ EIGEN_STATIC_ASSERT(_AmbientDim <= 3, THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE);
149
+
150
+ VectorType res;
151
+
152
+ Index mult = 1;
153
+ for(Index d=0; d<dim(); ++d)
154
+ {
155
+ if( mult & corner ) res[d] = m_max[d];
156
+ else res[d] = m_min[d];
157
+ mult *= 2;
158
+ }
159
+ return res;
160
+ }
161
+
162
+ /** \returns a random point inside the bounding box sampled with
163
+ * a uniform distribution */
164
+ inline VectorType sample() const
165
+ {
166
+ VectorType r(dim());
167
+ for(Index d=0; d<dim(); ++d)
168
+ {
169
+ if(!ScalarTraits::IsInteger)
170
+ {
171
+ r[d] = m_min[d] + (m_max[d]-m_min[d])
172
+ * internal::random<Scalar>(Scalar(0), Scalar(1));
173
+ }
174
+ else
175
+ r[d] = internal::random(m_min[d], m_max[d]);
176
+ }
177
+ return r;
178
+ }
179
+
180
+ /** \returns true if the point \a p is inside the box \c *this. */
181
+ template<typename Derived>
182
+ inline bool contains(const MatrixBase<Derived>& p) const
183
+ {
184
+ typename internal::nested<Derived,2>::type p_n(p.derived());
185
+ return (m_min.array()<=p_n.array()).all() && (p_n.array()<=m_max.array()).all();
186
+ }
187
+
188
+ /** \returns true if the box \a b is entirely inside the box \c *this. */
189
+ inline bool contains(const AlignedBox& b) const
190
+ { return (m_min.array()<=(b.min)().array()).all() && ((b.max)().array()<=m_max.array()).all(); }
191
+
192
+ /** \returns true if the box \a b is intersecting the box \c *this.
193
+ * \sa intersection, clamp */
194
+ inline bool intersects(const AlignedBox& b) const
195
+ { return (m_min.array()<=(b.max)().array()).all() && ((b.min)().array()<=m_max.array()).all(); }
196
+
197
+ /** Extends \c *this such that it contains the point \a p and returns a reference to \c *this.
198
+ * \sa extend(const AlignedBox&) */
199
+ template<typename Derived>
200
+ inline AlignedBox& extend(const MatrixBase<Derived>& p)
201
+ {
202
+ typename internal::nested<Derived,2>::type p_n(p.derived());
203
+ m_min = m_min.cwiseMin(p_n);
204
+ m_max = m_max.cwiseMax(p_n);
205
+ return *this;
206
+ }
207
+
208
+ /** Extends \c *this such that it contains the box \a b and returns a reference to \c *this.
209
+ * \sa merged, extend(const MatrixBase&) */
210
+ inline AlignedBox& extend(const AlignedBox& b)
211
+ {
212
+ m_min = m_min.cwiseMin(b.m_min);
213
+ m_max = m_max.cwiseMax(b.m_max);
214
+ return *this;
215
+ }
216
+
217
+ /** Clamps \c *this by the box \a b and returns a reference to \c *this.
218
+ * \note If the boxes don't intersect, the resulting box is empty.
219
+ * \sa intersection(), intersects() */
220
+ inline AlignedBox& clamp(const AlignedBox& b)
221
+ {
222
+ m_min = m_min.cwiseMax(b.m_min);
223
+ m_max = m_max.cwiseMin(b.m_max);
224
+ return *this;
225
+ }
226
+
227
+ /** Returns an AlignedBox that is the intersection of \a b and \c *this
228
+ * \note If the boxes don't intersect, the resulting box is empty.
229
+ * \sa intersects(), clamp, contains() */
230
+ inline AlignedBox intersection(const AlignedBox& b) const
231
+ {return AlignedBox(m_min.cwiseMax(b.m_min), m_max.cwiseMin(b.m_max)); }
232
+
233
+ /** Returns an AlignedBox that is the union of \a b and \c *this.
234
+ * \note Merging with an empty box may result in a box bigger than \c *this.
235
+ * \sa extend(const AlignedBox&) */
236
+ inline AlignedBox merged(const AlignedBox& b) const
237
+ { return AlignedBox(m_min.cwiseMin(b.m_min), m_max.cwiseMax(b.m_max)); }
238
+
239
+ /** Translate \c *this by the vector \a t and returns a reference to \c *this. */
240
+ template<typename Derived>
241
+ inline AlignedBox& translate(const MatrixBase<Derived>& a_t)
242
+ {
243
+ const typename internal::nested<Derived,2>::type t(a_t.derived());
244
+ m_min += t;
245
+ m_max += t;
246
+ return *this;
247
+ }
248
+
249
+ /** \returns the squared distance between the point \a p and the box \c *this,
250
+ * and zero if \a p is inside the box.
251
+ * \sa exteriorDistance(const MatrixBase&), squaredExteriorDistance(const AlignedBox&)
252
+ */
253
+ template<typename Derived>
254
+ inline Scalar squaredExteriorDistance(const MatrixBase<Derived>& p) const;
255
+
256
+ /** \returns the squared distance between the boxes \a b and \c *this,
257
+ * and zero if the boxes intersect.
258
+ * \sa exteriorDistance(const AlignedBox&), squaredExteriorDistance(const MatrixBase&)
259
+ */
260
+ inline Scalar squaredExteriorDistance(const AlignedBox& b) const;
261
+
262
+ /** \returns the distance between the point \a p and the box \c *this,
263
+ * and zero if \a p is inside the box.
264
+ * \sa squaredExteriorDistance(const MatrixBase&), exteriorDistance(const AlignedBox&)
265
+ */
266
+ template<typename Derived>
267
+ inline NonInteger exteriorDistance(const MatrixBase<Derived>& p) const
268
+ { using std::sqrt; return sqrt(NonInteger(squaredExteriorDistance(p))); }
269
+
270
+ /** \returns the distance between the boxes \a b and \c *this,
271
+ * and zero if the boxes intersect.
272
+ * \sa squaredExteriorDistance(const AlignedBox&), exteriorDistance(const MatrixBase&)
273
+ */
274
+ inline NonInteger exteriorDistance(const AlignedBox& b) const
275
+ { using std::sqrt; return sqrt(NonInteger(squaredExteriorDistance(b))); }
276
+
277
+ /** \returns \c *this with scalar type casted to \a NewScalarType
278
+ *
279
+ * Note that if \a NewScalarType is equal to the current scalar type of \c *this
280
+ * then this function smartly returns a const reference to \c *this.
281
+ */
282
+ template<typename NewScalarType>
283
+ inline typename internal::cast_return_type<AlignedBox,
284
+ AlignedBox<NewScalarType,AmbientDimAtCompileTime> >::type cast() const
285
+ {
286
+ return typename internal::cast_return_type<AlignedBox,
287
+ AlignedBox<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
288
+ }
289
+
290
+ /** Copy constructor with scalar type conversion */
291
+ template<typename OtherScalarType>
292
+ inline explicit AlignedBox(const AlignedBox<OtherScalarType,AmbientDimAtCompileTime>& other)
293
+ {
294
+ m_min = (other.min)().template cast<Scalar>();
295
+ m_max = (other.max)().template cast<Scalar>();
296
+ }
297
+
298
+ /** \returns \c true if \c *this is approximately equal to \a other, within the precision
299
+ * determined by \a prec.
300
+ *
301
+ * \sa MatrixBase::isApprox() */
302
+ bool isApprox(const AlignedBox& other, const RealScalar& prec = ScalarTraits::dummy_precision()) const
303
+ { return m_min.isApprox(other.m_min, prec) && m_max.isApprox(other.m_max, prec); }
304
+
305
+ protected:
306
+
307
+ VectorType m_min, m_max;
308
+ };
309
+
310
+
311
+
312
+ template<typename Scalar,int AmbientDim>
313
+ template<typename Derived>
314
+ inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const MatrixBase<Derived>& a_p) const
315
+ {
316
+ typename internal::nested<Derived,2*AmbientDim>::type p(a_p.derived());
317
+ Scalar dist2(0);
318
+ Scalar aux;
319
+ for (Index k=0; k<dim(); ++k)
320
+ {
321
+ if( m_min[k] > p[k] )
322
+ {
323
+ aux = m_min[k] - p[k];
324
+ dist2 += aux*aux;
325
+ }
326
+ else if( p[k] > m_max[k] )
327
+ {
328
+ aux = p[k] - m_max[k];
329
+ dist2 += aux*aux;
330
+ }
331
+ }
332
+ return dist2;
333
+ }
334
+
335
+ template<typename Scalar,int AmbientDim>
336
+ inline Scalar AlignedBox<Scalar,AmbientDim>::squaredExteriorDistance(const AlignedBox& b) const
337
+ {
338
+ Scalar dist2(0);
339
+ Scalar aux;
340
+ for (Index k=0; k<dim(); ++k)
341
+ {
342
+ if( m_min[k] > b.m_max[k] )
343
+ {
344
+ aux = m_min[k] - b.m_max[k];
345
+ dist2 += aux*aux;
346
+ }
347
+ else if( b.m_min[k] > m_max[k] )
348
+ {
349
+ aux = b.m_min[k] - m_max[k];
350
+ dist2 += aux*aux;
351
+ }
352
+ }
353
+ return dist2;
354
+ }
355
+
356
+ /** \defgroup alignedboxtypedefs Global aligned box typedefs
357
+ *
358
+ * \ingroup Geometry_Module
359
+ *
360
+ * Eigen defines several typedef shortcuts for most common aligned box types.
361
+ *
362
+ * The general patterns are the following:
363
+ *
364
+ * \c AlignedBoxSizeType where \c Size can be \c 1, \c 2,\c 3,\c 4 for fixed size boxes or \c X for dynamic size,
365
+ * and where \c Type can be \c i for integer, \c f for float, \c d for double.
366
+ *
367
+ * For example, \c AlignedBox3d is a fixed-size 3x3 aligned box type of doubles, and \c AlignedBoxXf is a dynamic-size aligned box of floats.
368
+ *
369
+ * \sa class AlignedBox
370
+ */
371
+
372
+ #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
373
+ /** \ingroup alignedboxtypedefs */ \
374
+ typedef AlignedBox<Type, Size> AlignedBox##SizeSuffix##TypeSuffix;
375
+
376
+ #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
377
+ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 1, 1) \
378
+ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
379
+ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
380
+ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
381
+ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X)
382
+
383
+ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i)
384
+ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f)
385
+ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d)
386
+
387
+ #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
388
+ #undef EIGEN_MAKE_TYPEDEFS
389
+
390
+ } // end namespace Eigen
391
+
392
+ #endif // EIGEN_ALIGNEDBOX_H
@@ -0,0 +1,233 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5
+ //
6
+ // This Source Code Form is subject to the terms of the Mozilla
7
+ // Public License v. 2.0. If a copy of the MPL was not distributed
8
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+
10
+ #ifndef EIGEN_ANGLEAXIS_H
11
+ #define EIGEN_ANGLEAXIS_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \geometry_module \ingroup Geometry_Module
16
+ *
17
+ * \class AngleAxis
18
+ *
19
+ * \brief Represents a 3D rotation as a rotation angle around an arbitrary 3D axis
20
+ *
21
+ * \param _Scalar the scalar type, i.e., the type of the coefficients.
22
+ *
23
+ * \warning When setting up an AngleAxis object, the axis vector \b must \b be \b normalized.
24
+ *
25
+ * The following two typedefs are provided for convenience:
26
+ * \li \c AngleAxisf for \c float
27
+ * \li \c AngleAxisd for \c double
28
+ *
29
+ * Combined with MatrixBase::Unit{X,Y,Z}, AngleAxis can be used to easily
30
+ * mimic Euler-angles. Here is an example:
31
+ * \include AngleAxis_mimic_euler.cpp
32
+ * Output: \verbinclude AngleAxis_mimic_euler.out
33
+ *
34
+ * \note This class is not aimed to be used to store a rotation transformation,
35
+ * but rather to make easier the creation of other rotation (Quaternion, rotation Matrix)
36
+ * and transformation objects.
37
+ *
38
+ * \sa class Quaternion, class Transform, MatrixBase::UnitX()
39
+ */
40
+
41
+ namespace internal {
42
+ template<typename _Scalar> struct traits<AngleAxis<_Scalar> >
43
+ {
44
+ typedef _Scalar Scalar;
45
+ };
46
+ }
47
+
48
+ template<typename _Scalar>
49
+ class AngleAxis : public RotationBase<AngleAxis<_Scalar>,3>
50
+ {
51
+ typedef RotationBase<AngleAxis<_Scalar>,3> Base;
52
+
53
+ public:
54
+
55
+ using Base::operator*;
56
+
57
+ enum { Dim = 3 };
58
+ /** the scalar type of the coefficients */
59
+ typedef _Scalar Scalar;
60
+ typedef Matrix<Scalar,3,3> Matrix3;
61
+ typedef Matrix<Scalar,3,1> Vector3;
62
+ typedef Quaternion<Scalar> QuaternionType;
63
+
64
+ protected:
65
+
66
+ Vector3 m_axis;
67
+ Scalar m_angle;
68
+
69
+ public:
70
+
71
+ /** Default constructor without initialization. */
72
+ AngleAxis() {}
73
+ /** Constructs and initialize the angle-axis rotation from an \a angle in radian
74
+ * and an \a axis which \b must \b be \b normalized.
75
+ *
76
+ * \warning If the \a axis vector is not normalized, then the angle-axis object
77
+ * represents an invalid rotation. */
78
+ template<typename Derived>
79
+ inline AngleAxis(const Scalar& angle, const MatrixBase<Derived>& axis) : m_axis(axis), m_angle(angle) {}
80
+ /** Constructs and initialize the angle-axis rotation from a quaternion \a q. */
81
+ template<typename QuatDerived> inline explicit AngleAxis(const QuaternionBase<QuatDerived>& q) { *this = q; }
82
+ /** Constructs and initialize the angle-axis rotation from a 3x3 rotation matrix. */
83
+ template<typename Derived>
84
+ inline explicit AngleAxis(const MatrixBase<Derived>& m) { *this = m; }
85
+
86
+ Scalar angle() const { return m_angle; }
87
+ Scalar& angle() { return m_angle; }
88
+
89
+ const Vector3& axis() const { return m_axis; }
90
+ Vector3& axis() { return m_axis; }
91
+
92
+ /** Concatenates two rotations */
93
+ inline QuaternionType operator* (const AngleAxis& other) const
94
+ { return QuaternionType(*this) * QuaternionType(other); }
95
+
96
+ /** Concatenates two rotations */
97
+ inline QuaternionType operator* (const QuaternionType& other) const
98
+ { return QuaternionType(*this) * other; }
99
+
100
+ /** Concatenates two rotations */
101
+ friend inline QuaternionType operator* (const QuaternionType& a, const AngleAxis& b)
102
+ { return a * QuaternionType(b); }
103
+
104
+ /** \returns the inverse rotation, i.e., an angle-axis with opposite rotation angle */
105
+ AngleAxis inverse() const
106
+ { return AngleAxis(-m_angle, m_axis); }
107
+
108
+ template<class QuatDerived>
109
+ AngleAxis& operator=(const QuaternionBase<QuatDerived>& q);
110
+ template<typename Derived>
111
+ AngleAxis& operator=(const MatrixBase<Derived>& m);
112
+
113
+ template<typename Derived>
114
+ AngleAxis& fromRotationMatrix(const MatrixBase<Derived>& m);
115
+ Matrix3 toRotationMatrix(void) const;
116
+
117
+ /** \returns \c *this with scalar type casted to \a NewScalarType
118
+ *
119
+ * Note that if \a NewScalarType is equal to the current scalar type of \c *this
120
+ * then this function smartly returns a const reference to \c *this.
121
+ */
122
+ template<typename NewScalarType>
123
+ inline typename internal::cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type cast() const
124
+ { return typename internal::cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type(*this); }
125
+
126
+ /** Copy constructor with scalar type conversion */
127
+ template<typename OtherScalarType>
128
+ inline explicit AngleAxis(const AngleAxis<OtherScalarType>& other)
129
+ {
130
+ m_axis = other.axis().template cast<Scalar>();
131
+ m_angle = Scalar(other.angle());
132
+ }
133
+
134
+ static inline const AngleAxis Identity() { return AngleAxis(Scalar(0), Vector3::UnitX()); }
135
+
136
+ /** \returns \c true if \c *this is approximately equal to \a other, within the precision
137
+ * determined by \a prec.
138
+ *
139
+ * \sa MatrixBase::isApprox() */
140
+ bool isApprox(const AngleAxis& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
141
+ { return m_axis.isApprox(other.m_axis, prec) && internal::isApprox(m_angle,other.m_angle, prec); }
142
+ };
143
+
144
+ /** \ingroup Geometry_Module
145
+ * single precision angle-axis type */
146
+ typedef AngleAxis<float> AngleAxisf;
147
+ /** \ingroup Geometry_Module
148
+ * double precision angle-axis type */
149
+ typedef AngleAxis<double> AngleAxisd;
150
+
151
+ /** Set \c *this from a \b unit quaternion.
152
+ * The axis is normalized.
153
+ *
154
+ * \warning As any other method dealing with quaternion, if the input quaternion
155
+ * is not normalized then the result is undefined.
156
+ */
157
+ template<typename Scalar>
158
+ template<typename QuatDerived>
159
+ AngleAxis<Scalar>& AngleAxis<Scalar>::operator=(const QuaternionBase<QuatDerived>& q)
160
+ {
161
+ using std::acos;
162
+ using std::min;
163
+ using std::max;
164
+ using std::sqrt;
165
+ Scalar n2 = q.vec().squaredNorm();
166
+ if (n2 < NumTraits<Scalar>::dummy_precision()*NumTraits<Scalar>::dummy_precision())
167
+ {
168
+ m_angle = Scalar(0);
169
+ m_axis << Scalar(1), Scalar(0), Scalar(0);
170
+ }
171
+ else
172
+ {
173
+ m_angle = Scalar(2)*acos((min)((max)(Scalar(-1),q.w()),Scalar(1)));
174
+ m_axis = q.vec() / sqrt(n2);
175
+ }
176
+ return *this;
177
+ }
178
+
179
+ /** Set \c *this from a 3x3 rotation matrix \a mat.
180
+ */
181
+ template<typename Scalar>
182
+ template<typename Derived>
183
+ AngleAxis<Scalar>& AngleAxis<Scalar>::operator=(const MatrixBase<Derived>& mat)
184
+ {
185
+ // Since a direct conversion would not be really faster,
186
+ // let's use the robust Quaternion implementation:
187
+ return *this = QuaternionType(mat);
188
+ }
189
+
190
+ /**
191
+ * \brief Sets \c *this from a 3x3 rotation matrix.
192
+ **/
193
+ template<typename Scalar>
194
+ template<typename Derived>
195
+ AngleAxis<Scalar>& AngleAxis<Scalar>::fromRotationMatrix(const MatrixBase<Derived>& mat)
196
+ {
197
+ return *this = QuaternionType(mat);
198
+ }
199
+
200
+ /** Constructs and \returns an equivalent 3x3 rotation matrix.
201
+ */
202
+ template<typename Scalar>
203
+ typename AngleAxis<Scalar>::Matrix3
204
+ AngleAxis<Scalar>::toRotationMatrix(void) const
205
+ {
206
+ using std::sin;
207
+ using std::cos;
208
+ Matrix3 res;
209
+ Vector3 sin_axis = sin(m_angle) * m_axis;
210
+ Scalar c = cos(m_angle);
211
+ Vector3 cos1_axis = (Scalar(1)-c) * m_axis;
212
+
213
+ Scalar tmp;
214
+ tmp = cos1_axis.x() * m_axis.y();
215
+ res.coeffRef(0,1) = tmp - sin_axis.z();
216
+ res.coeffRef(1,0) = tmp + sin_axis.z();
217
+
218
+ tmp = cos1_axis.x() * m_axis.z();
219
+ res.coeffRef(0,2) = tmp + sin_axis.y();
220
+ res.coeffRef(2,0) = tmp - sin_axis.y();
221
+
222
+ tmp = cos1_axis.y() * m_axis.z();
223
+ res.coeffRef(1,2) = tmp - sin_axis.x();
224
+ res.coeffRef(2,1) = tmp + sin_axis.x();
225
+
226
+ res.diagonal() = (cos1_axis.cwiseProduct(m_axis)).array() + c;
227
+
228
+ return res;
229
+ }
230
+
231
+ } // end namespace Eigen
232
+
233
+ #endif // EIGEN_ANGLEAXIS_H