ruby-eigen 0.0.9 → 0.0.10.pre1

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 (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,254 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
5
+ // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6
+ //
7
+ // This Source Code Form is subject to the terms of the Mozilla
8
+ // Public License v. 2.0. If a copy of the MPL was not distributed
9
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
+
11
+ // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
12
+
13
+ namespace Eigen {
14
+
15
+ /** \geometry_module \ingroup Geometry_Module
16
+ *
17
+ * \class Hyperplane
18
+ *
19
+ * \brief A hyperplane
20
+ *
21
+ * A hyperplane is an affine subspace of dimension n-1 in a space of dimension n.
22
+ * For example, a hyperplane in a plane is a line; a hyperplane in 3-space is a plane.
23
+ *
24
+ * \param _Scalar the scalar type, i.e., the type of the coefficients
25
+ * \param _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.
26
+ * Notice that the dimension of the hyperplane is _AmbientDim-1.
27
+ *
28
+ * This class represents an hyperplane as the zero set of the implicit equation
29
+ * \f$ n \cdot x + d = 0 \f$ where \f$ n \f$ is a unit normal vector of the plane (linear part)
30
+ * and \f$ d \f$ is the distance (offset) to the origin.
31
+ */
32
+ template <typename _Scalar, int _AmbientDim>
33
+ class Hyperplane
34
+ {
35
+ public:
36
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==Dynamic ? Dynamic : _AmbientDim+1)
37
+ enum { AmbientDimAtCompileTime = _AmbientDim };
38
+ typedef _Scalar Scalar;
39
+ typedef typename NumTraits<Scalar>::Real RealScalar;
40
+ typedef Matrix<Scalar,AmbientDimAtCompileTime,1> VectorType;
41
+ typedef Matrix<Scalar,int(AmbientDimAtCompileTime)==Dynamic
42
+ ? Dynamic
43
+ : int(AmbientDimAtCompileTime)+1,1> Coefficients;
44
+ typedef Block<Coefficients,AmbientDimAtCompileTime,1> NormalReturnType;
45
+
46
+ /** Default constructor without initialization */
47
+ inline Hyperplane() {}
48
+
49
+ /** Constructs a dynamic-size hyperplane with \a _dim the dimension
50
+ * of the ambient space */
51
+ inline explicit Hyperplane(int _dim) : m_coeffs(_dim+1) {}
52
+
53
+ /** Construct a plane from its normal \a n and a point \a e onto the plane.
54
+ * \warning the vector normal is assumed to be normalized.
55
+ */
56
+ inline Hyperplane(const VectorType& n, const VectorType& e)
57
+ : m_coeffs(n.size()+1)
58
+ {
59
+ normal() = n;
60
+ offset() = -e.eigen2_dot(n);
61
+ }
62
+
63
+ /** Constructs a plane from its normal \a n and distance to the origin \a d
64
+ * such that the algebraic equation of the plane is \f$ n \cdot x + d = 0 \f$.
65
+ * \warning the vector normal is assumed to be normalized.
66
+ */
67
+ inline Hyperplane(const VectorType& n, Scalar d)
68
+ : m_coeffs(n.size()+1)
69
+ {
70
+ normal() = n;
71
+ offset() = d;
72
+ }
73
+
74
+ /** Constructs a hyperplane passing through the two points. If the dimension of the ambient space
75
+ * is greater than 2, then there isn't uniqueness, so an arbitrary choice is made.
76
+ */
77
+ static inline Hyperplane Through(const VectorType& p0, const VectorType& p1)
78
+ {
79
+ Hyperplane result(p0.size());
80
+ result.normal() = (p1 - p0).unitOrthogonal();
81
+ result.offset() = -result.normal().eigen2_dot(p0);
82
+ return result;
83
+ }
84
+
85
+ /** Constructs a hyperplane passing through the three points. The dimension of the ambient space
86
+ * is required to be exactly 3.
87
+ */
88
+ static inline Hyperplane Through(const VectorType& p0, const VectorType& p1, const VectorType& p2)
89
+ {
90
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3)
91
+ Hyperplane result(p0.size());
92
+ result.normal() = (p2 - p0).cross(p1 - p0).normalized();
93
+ result.offset() = -result.normal().eigen2_dot(p0);
94
+ return result;
95
+ }
96
+
97
+ /** Constructs a hyperplane passing through the parametrized line \a parametrized.
98
+ * If the dimension of the ambient space is greater than 2, then there isn't uniqueness,
99
+ * so an arbitrary choice is made.
100
+ */
101
+ // FIXME to be consitent with the rest this could be implemented as a static Through function ??
102
+ explicit Hyperplane(const ParametrizedLine<Scalar, AmbientDimAtCompileTime>& parametrized)
103
+ {
104
+ normal() = parametrized.direction().unitOrthogonal();
105
+ offset() = -normal().eigen2_dot(parametrized.origin());
106
+ }
107
+
108
+ ~Hyperplane() {}
109
+
110
+ /** \returns the dimension in which the plane holds */
111
+ inline int dim() const { return int(AmbientDimAtCompileTime)==Dynamic ? m_coeffs.size()-1 : int(AmbientDimAtCompileTime); }
112
+
113
+ /** normalizes \c *this */
114
+ void normalize(void)
115
+ {
116
+ m_coeffs /= normal().norm();
117
+ }
118
+
119
+ /** \returns the signed distance between the plane \c *this and a point \a p.
120
+ * \sa absDistance()
121
+ */
122
+ inline Scalar signedDistance(const VectorType& p) const { return p.eigen2_dot(normal()) + offset(); }
123
+
124
+ /** \returns the absolute distance between the plane \c *this and a point \a p.
125
+ * \sa signedDistance()
126
+ */
127
+ inline Scalar absDistance(const VectorType& p) const { return ei_abs(signedDistance(p)); }
128
+
129
+ /** \returns the projection of a point \a p onto the plane \c *this.
130
+ */
131
+ inline VectorType projection(const VectorType& p) const { return p - signedDistance(p) * normal(); }
132
+
133
+ /** \returns a constant reference to the unit normal vector of the plane, which corresponds
134
+ * to the linear part of the implicit equation.
135
+ */
136
+ inline const NormalReturnType normal() const { return NormalReturnType(*const_cast<Coefficients*>(&m_coeffs),0,0,dim(),1); }
137
+
138
+ /** \returns a non-constant reference to the unit normal vector of the plane, which corresponds
139
+ * to the linear part of the implicit equation.
140
+ */
141
+ inline NormalReturnType normal() { return NormalReturnType(m_coeffs,0,0,dim(),1); }
142
+
143
+ /** \returns the distance to the origin, which is also the "constant term" of the implicit equation
144
+ * \warning the vector normal is assumed to be normalized.
145
+ */
146
+ inline const Scalar& offset() const { return m_coeffs.coeff(dim()); }
147
+
148
+ /** \returns a non-constant reference to the distance to the origin, which is also the constant part
149
+ * of the implicit equation */
150
+ inline Scalar& offset() { return m_coeffs(dim()); }
151
+
152
+ /** \returns a constant reference to the coefficients c_i of the plane equation:
153
+ * \f$ c_0*x_0 + ... + c_{d-1}*x_{d-1} + c_d = 0 \f$
154
+ */
155
+ inline const Coefficients& coeffs() const { return m_coeffs; }
156
+
157
+ /** \returns a non-constant reference to the coefficients c_i of the plane equation:
158
+ * \f$ c_0*x_0 + ... + c_{d-1}*x_{d-1} + c_d = 0 \f$
159
+ */
160
+ inline Coefficients& coeffs() { return m_coeffs; }
161
+
162
+ /** \returns the intersection of *this with \a other.
163
+ *
164
+ * \warning The ambient space must be a plane, i.e. have dimension 2, so that \c *this and \a other are lines.
165
+ *
166
+ * \note If \a other is approximately parallel to *this, this method will return any point on *this.
167
+ */
168
+ VectorType intersection(const Hyperplane& other)
169
+ {
170
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2)
171
+ Scalar det = coeffs().coeff(0) * other.coeffs().coeff(1) - coeffs().coeff(1) * other.coeffs().coeff(0);
172
+ // since the line equations ax+by=c are normalized with a^2+b^2=1, the following tests
173
+ // whether the two lines are approximately parallel.
174
+ if(ei_isMuchSmallerThan(det, Scalar(1)))
175
+ { // special case where the two lines are approximately parallel. Pick any point on the first line.
176
+ if(ei_abs(coeffs().coeff(1))>ei_abs(coeffs().coeff(0)))
177
+ return VectorType(coeffs().coeff(1), -coeffs().coeff(2)/coeffs().coeff(1)-coeffs().coeff(0));
178
+ else
179
+ return VectorType(-coeffs().coeff(2)/coeffs().coeff(0)-coeffs().coeff(1), coeffs().coeff(0));
180
+ }
181
+ else
182
+ { // general case
183
+ Scalar invdet = Scalar(1) / det;
184
+ return VectorType(invdet*(coeffs().coeff(1)*other.coeffs().coeff(2)-other.coeffs().coeff(1)*coeffs().coeff(2)),
185
+ invdet*(other.coeffs().coeff(0)*coeffs().coeff(2)-coeffs().coeff(0)*other.coeffs().coeff(2)));
186
+ }
187
+ }
188
+
189
+ /** Applies the transformation matrix \a mat to \c *this and returns a reference to \c *this.
190
+ *
191
+ * \param mat the Dim x Dim transformation matrix
192
+ * \param traits specifies whether the matrix \a mat represents an Isometry
193
+ * or a more generic Affine transformation. The default is Affine.
194
+ */
195
+ template<typename XprType>
196
+ inline Hyperplane& transform(const MatrixBase<XprType>& mat, TransformTraits traits = Affine)
197
+ {
198
+ if (traits==Affine)
199
+ normal() = mat.inverse().transpose() * normal();
200
+ else if (traits==Isometry)
201
+ normal() = mat * normal();
202
+ else
203
+ {
204
+ ei_assert("invalid traits value in Hyperplane::transform()");
205
+ }
206
+ return *this;
207
+ }
208
+
209
+ /** Applies the transformation \a t to \c *this and returns a reference to \c *this.
210
+ *
211
+ * \param t the transformation of dimension Dim
212
+ * \param traits specifies whether the transformation \a t represents an Isometry
213
+ * or a more generic Affine transformation. The default is Affine.
214
+ * Other kind of transformations are not supported.
215
+ */
216
+ inline Hyperplane& transform(const Transform<Scalar,AmbientDimAtCompileTime>& t,
217
+ TransformTraits traits = Affine)
218
+ {
219
+ transform(t.linear(), traits);
220
+ offset() -= t.translation().eigen2_dot(normal());
221
+ return *this;
222
+ }
223
+
224
+ /** \returns \c *this with scalar type casted to \a NewScalarType
225
+ *
226
+ * Note that if \a NewScalarType is equal to the current scalar type of \c *this
227
+ * then this function smartly returns a const reference to \c *this.
228
+ */
229
+ template<typename NewScalarType>
230
+ inline typename internal::cast_return_type<Hyperplane,
231
+ Hyperplane<NewScalarType,AmbientDimAtCompileTime> >::type cast() const
232
+ {
233
+ return typename internal::cast_return_type<Hyperplane,
234
+ Hyperplane<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
235
+ }
236
+
237
+ /** Copy constructor with scalar type conversion */
238
+ template<typename OtherScalarType>
239
+ inline explicit Hyperplane(const Hyperplane<OtherScalarType,AmbientDimAtCompileTime>& other)
240
+ { m_coeffs = other.coeffs().template cast<Scalar>(); }
241
+
242
+ /** \returns \c true if \c *this is approximately equal to \a other, within the precision
243
+ * determined by \a prec.
244
+ *
245
+ * \sa MatrixBase::isApprox() */
246
+ bool isApprox(const Hyperplane& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
247
+ { return m_coeffs.isApprox(other.m_coeffs, prec); }
248
+
249
+ protected:
250
+
251
+ Coefficients m_coeffs;
252
+ };
253
+
254
+ } // end namespace Eigen
@@ -0,0 +1,141 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
5
+ // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6
+ //
7
+ // This Source Code Form is subject to the terms of the Mozilla
8
+ // Public License v. 2.0. If a copy of the MPL was not distributed
9
+ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
+
11
+ // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
12
+
13
+ namespace Eigen {
14
+
15
+ /** \geometry_module \ingroup Geometry_Module
16
+ *
17
+ * \class ParametrizedLine
18
+ *
19
+ * \brief A parametrized line
20
+ *
21
+ * A parametrized line is defined by an origin point \f$ \mathbf{o} \f$ and a unit
22
+ * direction vector \f$ \mathbf{d} \f$ such that the line corresponds to
23
+ * the set \f$ l(t) = \mathbf{o} + t \mathbf{d} \f$, \f$ l \in \mathbf{R} \f$.
24
+ *
25
+ * \param _Scalar the scalar type, i.e., the type of the coefficients
26
+ * \param _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.
27
+ */
28
+ template <typename _Scalar, int _AmbientDim>
29
+ class ParametrizedLine
30
+ {
31
+ public:
32
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
33
+ enum { AmbientDimAtCompileTime = _AmbientDim };
34
+ typedef _Scalar Scalar;
35
+ typedef typename NumTraits<Scalar>::Real RealScalar;
36
+ typedef Matrix<Scalar,AmbientDimAtCompileTime,1> VectorType;
37
+
38
+ /** Default constructor without initialization */
39
+ inline ParametrizedLine() {}
40
+
41
+ /** Constructs a dynamic-size line with \a _dim the dimension
42
+ * of the ambient space */
43
+ inline explicit ParametrizedLine(int _dim) : m_origin(_dim), m_direction(_dim) {}
44
+
45
+ /** Initializes a parametrized line of direction \a direction and origin \a origin.
46
+ * \warning the vector direction is assumed to be normalized.
47
+ */
48
+ ParametrizedLine(const VectorType& origin, const VectorType& direction)
49
+ : m_origin(origin), m_direction(direction) {}
50
+
51
+ explicit ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim>& hyperplane);
52
+
53
+ /** Constructs a parametrized line going from \a p0 to \a p1. */
54
+ static inline ParametrizedLine Through(const VectorType& p0, const VectorType& p1)
55
+ { return ParametrizedLine(p0, (p1-p0).normalized()); }
56
+
57
+ ~ParametrizedLine() {}
58
+
59
+ /** \returns the dimension in which the line holds */
60
+ inline int dim() const { return m_direction.size(); }
61
+
62
+ const VectorType& origin() const { return m_origin; }
63
+ VectorType& origin() { return m_origin; }
64
+
65
+ const VectorType& direction() const { return m_direction; }
66
+ VectorType& direction() { return m_direction; }
67
+
68
+ /** \returns the squared distance of a point \a p to its projection onto the line \c *this.
69
+ * \sa distance()
70
+ */
71
+ RealScalar squaredDistance(const VectorType& p) const
72
+ {
73
+ VectorType diff = p-origin();
74
+ return (diff - diff.eigen2_dot(direction())* direction()).squaredNorm();
75
+ }
76
+ /** \returns the distance of a point \a p to its projection onto the line \c *this.
77
+ * \sa squaredDistance()
78
+ */
79
+ RealScalar distance(const VectorType& p) const { return ei_sqrt(squaredDistance(p)); }
80
+
81
+ /** \returns the projection of a point \a p onto the line \c *this. */
82
+ VectorType projection(const VectorType& p) const
83
+ { return origin() + (p-origin()).eigen2_dot(direction()) * direction(); }
84
+
85
+ Scalar intersection(const Hyperplane<_Scalar, _AmbientDim>& hyperplane);
86
+
87
+ /** \returns \c *this with scalar type casted to \a NewScalarType
88
+ *
89
+ * Note that if \a NewScalarType is equal to the current scalar type of \c *this
90
+ * then this function smartly returns a const reference to \c *this.
91
+ */
92
+ template<typename NewScalarType>
93
+ inline typename internal::cast_return_type<ParametrizedLine,
94
+ ParametrizedLine<NewScalarType,AmbientDimAtCompileTime> >::type cast() const
95
+ {
96
+ return typename internal::cast_return_type<ParametrizedLine,
97
+ ParametrizedLine<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
98
+ }
99
+
100
+ /** Copy constructor with scalar type conversion */
101
+ template<typename OtherScalarType>
102
+ inline explicit ParametrizedLine(const ParametrizedLine<OtherScalarType,AmbientDimAtCompileTime>& other)
103
+ {
104
+ m_origin = other.origin().template cast<Scalar>();
105
+ m_direction = other.direction().template cast<Scalar>();
106
+ }
107
+
108
+ /** \returns \c true if \c *this is approximately equal to \a other, within the precision
109
+ * determined by \a prec.
110
+ *
111
+ * \sa MatrixBase::isApprox() */
112
+ bool isApprox(const ParametrizedLine& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
113
+ { return m_origin.isApprox(other.m_origin, prec) && m_direction.isApprox(other.m_direction, prec); }
114
+
115
+ protected:
116
+
117
+ VectorType m_origin, m_direction;
118
+ };
119
+
120
+ /** Constructs a parametrized line from a 2D hyperplane
121
+ *
122
+ * \warning the ambient space must have dimension 2 such that the hyperplane actually describes a line
123
+ */
124
+ template <typename _Scalar, int _AmbientDim>
125
+ inline ParametrizedLine<_Scalar, _AmbientDim>::ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim>& hyperplane)
126
+ {
127
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2)
128
+ direction() = hyperplane.normal().unitOrthogonal();
129
+ origin() = -hyperplane.normal()*hyperplane.offset();
130
+ }
131
+
132
+ /** \returns the parameter value of the intersection between \c *this and the given hyperplane
133
+ */
134
+ template <typename _Scalar, int _AmbientDim>
135
+ inline _Scalar ParametrizedLine<_Scalar, _AmbientDim>::intersection(const Hyperplane<_Scalar, _AmbientDim>& hyperplane)
136
+ {
137
+ return -(hyperplane.offset()+origin().eigen2_dot(hyperplane.normal()))
138
+ /(direction().eigen2_dot(hyperplane.normal()));
139
+ }
140
+
141
+ } // end namespace Eigen
@@ -0,0 +1,495 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Gael Guennebaud <g.gael@free.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
+ // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
11
+
12
+ namespace Eigen {
13
+
14
+ template<typename Other,
15
+ int OtherRows=Other::RowsAtCompileTime,
16
+ int OtherCols=Other::ColsAtCompileTime>
17
+ struct ei_quaternion_assign_impl;
18
+
19
+ /** \geometry_module \ingroup Geometry_Module
20
+ *
21
+ * \class Quaternion
22
+ *
23
+ * \brief The quaternion class used to represent 3D orientations and rotations
24
+ *
25
+ * \param _Scalar the scalar type, i.e., the type of the coefficients
26
+ *
27
+ * This class represents a quaternion \f$ w+xi+yj+zk \f$ that is a convenient representation of
28
+ * orientations and rotations of objects in three dimensions. Compared to other representations
29
+ * like Euler angles or 3x3 matrices, quatertions offer the following advantages:
30
+ * \li \b compact storage (4 scalars)
31
+ * \li \b efficient to compose (28 flops),
32
+ * \li \b stable spherical interpolation
33
+ *
34
+ * The following two typedefs are provided for convenience:
35
+ * \li \c Quaternionf for \c float
36
+ * \li \c Quaterniond for \c double
37
+ *
38
+ * \sa class AngleAxis, class Transform
39
+ */
40
+
41
+ template<typename _Scalar> struct ei_traits<Quaternion<_Scalar> >
42
+ {
43
+ typedef _Scalar Scalar;
44
+ };
45
+
46
+ template<typename _Scalar>
47
+ class Quaternion : public RotationBase<Quaternion<_Scalar>,3>
48
+ {
49
+ typedef RotationBase<Quaternion<_Scalar>,3> Base;
50
+
51
+ public:
52
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,4)
53
+
54
+ using Base::operator*;
55
+
56
+ /** the scalar type of the coefficients */
57
+ typedef _Scalar Scalar;
58
+
59
+ /** the type of the Coefficients 4-vector */
60
+ typedef Matrix<Scalar, 4, 1> Coefficients;
61
+ /** the type of a 3D vector */
62
+ typedef Matrix<Scalar,3,1> Vector3;
63
+ /** the equivalent rotation matrix type */
64
+ typedef Matrix<Scalar,3,3> Matrix3;
65
+ /** the equivalent angle-axis type */
66
+ typedef AngleAxis<Scalar> AngleAxisType;
67
+
68
+ /** \returns the \c x coefficient */
69
+ inline Scalar x() const { return m_coeffs.coeff(0); }
70
+ /** \returns the \c y coefficient */
71
+ inline Scalar y() const { return m_coeffs.coeff(1); }
72
+ /** \returns the \c z coefficient */
73
+ inline Scalar z() const { return m_coeffs.coeff(2); }
74
+ /** \returns the \c w coefficient */
75
+ inline Scalar w() const { return m_coeffs.coeff(3); }
76
+
77
+ /** \returns a reference to the \c x coefficient */
78
+ inline Scalar& x() { return m_coeffs.coeffRef(0); }
79
+ /** \returns a reference to the \c y coefficient */
80
+ inline Scalar& y() { return m_coeffs.coeffRef(1); }
81
+ /** \returns a reference to the \c z coefficient */
82
+ inline Scalar& z() { return m_coeffs.coeffRef(2); }
83
+ /** \returns a reference to the \c w coefficient */
84
+ inline Scalar& w() { return m_coeffs.coeffRef(3); }
85
+
86
+ /** \returns a read-only vector expression of the imaginary part (x,y,z) */
87
+ inline const Block<const Coefficients,3,1> vec() const { return m_coeffs.template start<3>(); }
88
+
89
+ /** \returns a vector expression of the imaginary part (x,y,z) */
90
+ inline Block<Coefficients,3,1> vec() { return m_coeffs.template start<3>(); }
91
+
92
+ /** \returns a read-only vector expression of the coefficients (x,y,z,w) */
93
+ inline const Coefficients& coeffs() const { return m_coeffs; }
94
+
95
+ /** \returns a vector expression of the coefficients (x,y,z,w) */
96
+ inline Coefficients& coeffs() { return m_coeffs; }
97
+
98
+ /** Default constructor leaving the quaternion uninitialized. */
99
+ inline Quaternion() {}
100
+
101
+ /** Constructs and initializes the quaternion \f$ w+xi+yj+zk \f$ from
102
+ * its four coefficients \a w, \a x, \a y and \a z.
103
+ *
104
+ * \warning Note the order of the arguments: the real \a w coefficient first,
105
+ * while internally the coefficients are stored in the following order:
106
+ * [\c x, \c y, \c z, \c w]
107
+ */
108
+ inline Quaternion(Scalar w, Scalar x, Scalar y, Scalar z)
109
+ { m_coeffs << x, y, z, w; }
110
+
111
+ /** Copy constructor */
112
+ inline Quaternion(const Quaternion& other) { m_coeffs = other.m_coeffs; }
113
+
114
+ /** Constructs and initializes a quaternion from the angle-axis \a aa */
115
+ explicit inline Quaternion(const AngleAxisType& aa) { *this = aa; }
116
+
117
+ /** Constructs and initializes a quaternion from either:
118
+ * - a rotation matrix expression,
119
+ * - a 4D vector expression representing quaternion coefficients.
120
+ * \sa operator=(MatrixBase<Derived>)
121
+ */
122
+ template<typename Derived>
123
+ explicit inline Quaternion(const MatrixBase<Derived>& other) { *this = other; }
124
+
125
+ Quaternion& operator=(const Quaternion& other);
126
+ Quaternion& operator=(const AngleAxisType& aa);
127
+ template<typename Derived>
128
+ Quaternion& operator=(const MatrixBase<Derived>& m);
129
+
130
+ /** \returns a quaternion representing an identity rotation
131
+ * \sa MatrixBase::Identity()
132
+ */
133
+ static inline Quaternion Identity() { return Quaternion(1, 0, 0, 0); }
134
+
135
+ /** \sa Quaternion::Identity(), MatrixBase::setIdentity()
136
+ */
137
+ inline Quaternion& setIdentity() { m_coeffs << 0, 0, 0, 1; return *this; }
138
+
139
+ /** \returns the squared norm of the quaternion's coefficients
140
+ * \sa Quaternion::norm(), MatrixBase::squaredNorm()
141
+ */
142
+ inline Scalar squaredNorm() const { return m_coeffs.squaredNorm(); }
143
+
144
+ /** \returns the norm of the quaternion's coefficients
145
+ * \sa Quaternion::squaredNorm(), MatrixBase::norm()
146
+ */
147
+ inline Scalar norm() const { return m_coeffs.norm(); }
148
+
149
+ /** Normalizes the quaternion \c *this
150
+ * \sa normalized(), MatrixBase::normalize() */
151
+ inline void normalize() { m_coeffs.normalize(); }
152
+ /** \returns a normalized version of \c *this
153
+ * \sa normalize(), MatrixBase::normalized() */
154
+ inline Quaternion normalized() const { return Quaternion(m_coeffs.normalized()); }
155
+
156
+ /** \returns the dot product of \c *this and \a other
157
+ * Geometrically speaking, the dot product of two unit quaternions
158
+ * corresponds to the cosine of half the angle between the two rotations.
159
+ * \sa angularDistance()
160
+ */
161
+ inline Scalar eigen2_dot(const Quaternion& other) const { return m_coeffs.eigen2_dot(other.m_coeffs); }
162
+
163
+ inline Scalar angularDistance(const Quaternion& other) const;
164
+
165
+ Matrix3 toRotationMatrix(void) const;
166
+
167
+ template<typename Derived1, typename Derived2>
168
+ Quaternion& setFromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b);
169
+
170
+ inline Quaternion operator* (const Quaternion& q) const;
171
+ inline Quaternion& operator*= (const Quaternion& q);
172
+
173
+ Quaternion inverse(void) const;
174
+ Quaternion conjugate(void) const;
175
+
176
+ Quaternion slerp(Scalar t, const Quaternion& other) const;
177
+
178
+ template<typename Derived>
179
+ Vector3 operator* (const MatrixBase<Derived>& vec) const;
180
+
181
+ /** \returns \c *this with scalar type casted to \a NewScalarType
182
+ *
183
+ * Note that if \a NewScalarType is equal to the current scalar type of \c *this
184
+ * then this function smartly returns a const reference to \c *this.
185
+ */
186
+ template<typename NewScalarType>
187
+ inline typename internal::cast_return_type<Quaternion,Quaternion<NewScalarType> >::type cast() const
188
+ { return typename internal::cast_return_type<Quaternion,Quaternion<NewScalarType> >::type(*this); }
189
+
190
+ /** Copy constructor with scalar type conversion */
191
+ template<typename OtherScalarType>
192
+ inline explicit Quaternion(const Quaternion<OtherScalarType>& other)
193
+ { m_coeffs = other.coeffs().template cast<Scalar>(); }
194
+
195
+ /** \returns \c true if \c *this is approximately equal to \a other, within the precision
196
+ * determined by \a prec.
197
+ *
198
+ * \sa MatrixBase::isApprox() */
199
+ bool isApprox(const Quaternion& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
200
+ { return m_coeffs.isApprox(other.m_coeffs, prec); }
201
+
202
+ protected:
203
+ Coefficients m_coeffs;
204
+ };
205
+
206
+ /** \ingroup Geometry_Module
207
+ * single precision quaternion type */
208
+ typedef Quaternion<float> Quaternionf;
209
+ /** \ingroup Geometry_Module
210
+ * double precision quaternion type */
211
+ typedef Quaternion<double> Quaterniond;
212
+
213
+ // Generic Quaternion * Quaternion product
214
+ template<typename Scalar> inline Quaternion<Scalar>
215
+ ei_quaternion_product(const Quaternion<Scalar>& a, const Quaternion<Scalar>& b)
216
+ {
217
+ return Quaternion<Scalar>
218
+ (
219
+ a.w() * b.w() - a.x() * b.x() - a.y() * b.y() - a.z() * b.z(),
220
+ a.w() * b.x() + a.x() * b.w() + a.y() * b.z() - a.z() * b.y(),
221
+ a.w() * b.y() + a.y() * b.w() + a.z() * b.x() - a.x() * b.z(),
222
+ a.w() * b.z() + a.z() * b.w() + a.x() * b.y() - a.y() * b.x()
223
+ );
224
+ }
225
+
226
+ /** \returns the concatenation of two rotations as a quaternion-quaternion product */
227
+ template <typename Scalar>
228
+ inline Quaternion<Scalar> Quaternion<Scalar>::operator* (const Quaternion& other) const
229
+ {
230
+ return ei_quaternion_product(*this,other);
231
+ }
232
+
233
+ /** \sa operator*(Quaternion) */
234
+ template <typename Scalar>
235
+ inline Quaternion<Scalar>& Quaternion<Scalar>::operator*= (const Quaternion& other)
236
+ {
237
+ return (*this = *this * other);
238
+ }
239
+
240
+ /** Rotation of a vector by a quaternion.
241
+ * \remarks If the quaternion is used to rotate several points (>1)
242
+ * then it is much more efficient to first convert it to a 3x3 Matrix.
243
+ * Comparison of the operation cost for n transformations:
244
+ * - Quaternion: 30n
245
+ * - Via a Matrix3: 24 + 15n
246
+ */
247
+ template <typename Scalar>
248
+ template<typename Derived>
249
+ inline typename Quaternion<Scalar>::Vector3
250
+ Quaternion<Scalar>::operator* (const MatrixBase<Derived>& v) const
251
+ {
252
+ // Note that this algorithm comes from the optimization by hand
253
+ // of the conversion to a Matrix followed by a Matrix/Vector product.
254
+ // It appears to be much faster than the common algorithm found
255
+ // in the litterature (30 versus 39 flops). It also requires two
256
+ // Vector3 as temporaries.
257
+ Vector3 uv;
258
+ uv = 2 * this->vec().cross(v);
259
+ return v + this->w() * uv + this->vec().cross(uv);
260
+ }
261
+
262
+ template<typename Scalar>
263
+ inline Quaternion<Scalar>& Quaternion<Scalar>::operator=(const Quaternion& other)
264
+ {
265
+ m_coeffs = other.m_coeffs;
266
+ return *this;
267
+ }
268
+
269
+ /** Set \c *this from an angle-axis \a aa and returns a reference to \c *this
270
+ */
271
+ template<typename Scalar>
272
+ inline Quaternion<Scalar>& Quaternion<Scalar>::operator=(const AngleAxisType& aa)
273
+ {
274
+ Scalar ha = Scalar(0.5)*aa.angle(); // Scalar(0.5) to suppress precision loss warnings
275
+ this->w() = ei_cos(ha);
276
+ this->vec() = ei_sin(ha) * aa.axis();
277
+ return *this;
278
+ }
279
+
280
+ /** Set \c *this from the expression \a xpr:
281
+ * - if \a xpr is a 4x1 vector, then \a xpr is assumed to be a quaternion
282
+ * - if \a xpr is a 3x3 matrix, then \a xpr is assumed to be rotation matrix
283
+ * and \a xpr is converted to a quaternion
284
+ */
285
+ template<typename Scalar>
286
+ template<typename Derived>
287
+ inline Quaternion<Scalar>& Quaternion<Scalar>::operator=(const MatrixBase<Derived>& xpr)
288
+ {
289
+ ei_quaternion_assign_impl<Derived>::run(*this, xpr.derived());
290
+ return *this;
291
+ }
292
+
293
+ /** Convert the quaternion to a 3x3 rotation matrix */
294
+ template<typename Scalar>
295
+ inline typename Quaternion<Scalar>::Matrix3
296
+ Quaternion<Scalar>::toRotationMatrix(void) const
297
+ {
298
+ // NOTE if inlined, then gcc 4.2 and 4.4 get rid of the temporary (not gcc 4.3 !!)
299
+ // if not inlined then the cost of the return by value is huge ~ +35%,
300
+ // however, not inlining this function is an order of magnitude slower, so
301
+ // it has to be inlined, and so the return by value is not an issue
302
+ Matrix3 res;
303
+
304
+ const Scalar tx = Scalar(2)*this->x();
305
+ const Scalar ty = Scalar(2)*this->y();
306
+ const Scalar tz = Scalar(2)*this->z();
307
+ const Scalar twx = tx*this->w();
308
+ const Scalar twy = ty*this->w();
309
+ const Scalar twz = tz*this->w();
310
+ const Scalar txx = tx*this->x();
311
+ const Scalar txy = ty*this->x();
312
+ const Scalar txz = tz*this->x();
313
+ const Scalar tyy = ty*this->y();
314
+ const Scalar tyz = tz*this->y();
315
+ const Scalar tzz = tz*this->z();
316
+
317
+ res.coeffRef(0,0) = Scalar(1)-(tyy+tzz);
318
+ res.coeffRef(0,1) = txy-twz;
319
+ res.coeffRef(0,2) = txz+twy;
320
+ res.coeffRef(1,0) = txy+twz;
321
+ res.coeffRef(1,1) = Scalar(1)-(txx+tzz);
322
+ res.coeffRef(1,2) = tyz-twx;
323
+ res.coeffRef(2,0) = txz-twy;
324
+ res.coeffRef(2,1) = tyz+twx;
325
+ res.coeffRef(2,2) = Scalar(1)-(txx+tyy);
326
+
327
+ return res;
328
+ }
329
+
330
+ /** Sets *this to be a quaternion representing a rotation sending the vector \a a to the vector \a b.
331
+ *
332
+ * \returns a reference to *this.
333
+ *
334
+ * Note that the two input vectors do \b not have to be normalized.
335
+ */
336
+ template<typename Scalar>
337
+ template<typename Derived1, typename Derived2>
338
+ inline Quaternion<Scalar>& Quaternion<Scalar>::setFromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b)
339
+ {
340
+ Vector3 v0 = a.normalized();
341
+ Vector3 v1 = b.normalized();
342
+ Scalar c = v0.eigen2_dot(v1);
343
+
344
+ // if dot == 1, vectors are the same
345
+ if (ei_isApprox(c,Scalar(1)))
346
+ {
347
+ // set to identity
348
+ this->w() = 1; this->vec().setZero();
349
+ return *this;
350
+ }
351
+ // if dot == -1, vectors are opposites
352
+ if (ei_isApprox(c,Scalar(-1)))
353
+ {
354
+ this->vec() = v0.unitOrthogonal();
355
+ this->w() = 0;
356
+ return *this;
357
+ }
358
+
359
+ Vector3 axis = v0.cross(v1);
360
+ Scalar s = ei_sqrt((Scalar(1)+c)*Scalar(2));
361
+ Scalar invs = Scalar(1)/s;
362
+ this->vec() = axis * invs;
363
+ this->w() = s * Scalar(0.5);
364
+
365
+ return *this;
366
+ }
367
+
368
+ /** \returns the multiplicative inverse of \c *this
369
+ * Note that in most cases, i.e., if you simply want the opposite rotation,
370
+ * and/or the quaternion is normalized, then it is enough to use the conjugate.
371
+ *
372
+ * \sa Quaternion::conjugate()
373
+ */
374
+ template <typename Scalar>
375
+ inline Quaternion<Scalar> Quaternion<Scalar>::inverse() const
376
+ {
377
+ // FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
378
+ Scalar n2 = this->squaredNorm();
379
+ if (n2 > 0)
380
+ return Quaternion(conjugate().coeffs() / n2);
381
+ else
382
+ {
383
+ // return an invalid result to flag the error
384
+ return Quaternion(Coefficients::Zero());
385
+ }
386
+ }
387
+
388
+ /** \returns the conjugate of the \c *this which is equal to the multiplicative inverse
389
+ * if the quaternion is normalized.
390
+ * The conjugate of a quaternion represents the opposite rotation.
391
+ *
392
+ * \sa Quaternion::inverse()
393
+ */
394
+ template <typename Scalar>
395
+ inline Quaternion<Scalar> Quaternion<Scalar>::conjugate() const
396
+ {
397
+ return Quaternion(this->w(),-this->x(),-this->y(),-this->z());
398
+ }
399
+
400
+ /** \returns the angle (in radian) between two rotations
401
+ * \sa eigen2_dot()
402
+ */
403
+ template <typename Scalar>
404
+ inline Scalar Quaternion<Scalar>::angularDistance(const Quaternion& other) const
405
+ {
406
+ double d = ei_abs(this->eigen2_dot(other));
407
+ if (d>=1.0)
408
+ return 0;
409
+ return Scalar(2) * std::acos(d);
410
+ }
411
+
412
+ /** \returns the spherical linear interpolation between the two quaternions
413
+ * \c *this and \a other at the parameter \a t
414
+ */
415
+ template <typename Scalar>
416
+ Quaternion<Scalar> Quaternion<Scalar>::slerp(Scalar t, const Quaternion& other) const
417
+ {
418
+ static const Scalar one = Scalar(1) - machine_epsilon<Scalar>();
419
+ Scalar d = this->eigen2_dot(other);
420
+ Scalar absD = ei_abs(d);
421
+
422
+ Scalar scale0;
423
+ Scalar scale1;
424
+
425
+ if (absD>=one)
426
+ {
427
+ scale0 = Scalar(1) - t;
428
+ scale1 = t;
429
+ }
430
+ else
431
+ {
432
+ // theta is the angle between the 2 quaternions
433
+ Scalar theta = std::acos(absD);
434
+ Scalar sinTheta = ei_sin(theta);
435
+
436
+ scale0 = ei_sin( ( Scalar(1) - t ) * theta) / sinTheta;
437
+ scale1 = ei_sin( ( t * theta) ) / sinTheta;
438
+ if (d<0)
439
+ scale1 = -scale1;
440
+ }
441
+
442
+ return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
443
+ }
444
+
445
+ // set from a rotation matrix
446
+ template<typename Other>
447
+ struct ei_quaternion_assign_impl<Other,3,3>
448
+ {
449
+ typedef typename Other::Scalar Scalar;
450
+ static inline void run(Quaternion<Scalar>& q, const Other& mat)
451
+ {
452
+ // This algorithm comes from "Quaternion Calculus and Fast Animation",
453
+ // Ken Shoemake, 1987 SIGGRAPH course notes
454
+ Scalar t = mat.trace();
455
+ if (t > 0)
456
+ {
457
+ t = ei_sqrt(t + Scalar(1.0));
458
+ q.w() = Scalar(0.5)*t;
459
+ t = Scalar(0.5)/t;
460
+ q.x() = (mat.coeff(2,1) - mat.coeff(1,2)) * t;
461
+ q.y() = (mat.coeff(0,2) - mat.coeff(2,0)) * t;
462
+ q.z() = (mat.coeff(1,0) - mat.coeff(0,1)) * t;
463
+ }
464
+ else
465
+ {
466
+ int i = 0;
467
+ if (mat.coeff(1,1) > mat.coeff(0,0))
468
+ i = 1;
469
+ if (mat.coeff(2,2) > mat.coeff(i,i))
470
+ i = 2;
471
+ int j = (i+1)%3;
472
+ int k = (j+1)%3;
473
+
474
+ t = ei_sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0));
475
+ q.coeffs().coeffRef(i) = Scalar(0.5) * t;
476
+ t = Scalar(0.5)/t;
477
+ q.w() = (mat.coeff(k,j)-mat.coeff(j,k))*t;
478
+ q.coeffs().coeffRef(j) = (mat.coeff(j,i)+mat.coeff(i,j))*t;
479
+ q.coeffs().coeffRef(k) = (mat.coeff(k,i)+mat.coeff(i,k))*t;
480
+ }
481
+ }
482
+ };
483
+
484
+ // set from a vector of coefficients assumed to be a quaternion
485
+ template<typename Other>
486
+ struct ei_quaternion_assign_impl<Other,4,1>
487
+ {
488
+ typedef typename Other::Scalar Scalar;
489
+ static inline void run(Quaternion<Scalar>& q, const Other& vec)
490
+ {
491
+ q.coeffs() = vec;
492
+ }
493
+ };
494
+
495
+ } // end namespace Eigen