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,184 @@
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
+ /** \geometry_module \ingroup Geometry_Module
15
+ *
16
+ * \class Translation
17
+ *
18
+ * \brief Represents a translation transformation
19
+ *
20
+ * \param _Scalar the scalar type, i.e., the type of the coefficients.
21
+ * \param _Dim the dimension of the space, can be a compile time value or Dynamic
22
+ *
23
+ * \note This class is not aimed to be used to store a translation transformation,
24
+ * but rather to make easier the constructions and updates of Transform objects.
25
+ *
26
+ * \sa class Scaling, class Transform
27
+ */
28
+ template<typename _Scalar, int _Dim>
29
+ class Translation
30
+ {
31
+ public:
32
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim)
33
+ /** dimension of the space */
34
+ enum { Dim = _Dim };
35
+ /** the scalar type of the coefficients */
36
+ typedef _Scalar Scalar;
37
+ /** corresponding vector type */
38
+ typedef Matrix<Scalar,Dim,1> VectorType;
39
+ /** corresponding linear transformation matrix type */
40
+ typedef Matrix<Scalar,Dim,Dim> LinearMatrixType;
41
+ /** corresponding scaling transformation type */
42
+ typedef Scaling<Scalar,Dim> ScalingType;
43
+ /** corresponding affine transformation type */
44
+ typedef Transform<Scalar,Dim> TransformType;
45
+
46
+ protected:
47
+
48
+ VectorType m_coeffs;
49
+
50
+ public:
51
+
52
+ /** Default constructor without initialization. */
53
+ Translation() {}
54
+ /** */
55
+ inline Translation(const Scalar& sx, const Scalar& sy)
56
+ {
57
+ ei_assert(Dim==2);
58
+ m_coeffs.x() = sx;
59
+ m_coeffs.y() = sy;
60
+ }
61
+ /** */
62
+ inline Translation(const Scalar& sx, const Scalar& sy, const Scalar& sz)
63
+ {
64
+ ei_assert(Dim==3);
65
+ m_coeffs.x() = sx;
66
+ m_coeffs.y() = sy;
67
+ m_coeffs.z() = sz;
68
+ }
69
+ /** Constructs and initialize the scaling transformation from a vector of scaling coefficients */
70
+ explicit inline Translation(const VectorType& vector) : m_coeffs(vector) {}
71
+
72
+ const VectorType& vector() const { return m_coeffs; }
73
+ VectorType& vector() { return m_coeffs; }
74
+
75
+ /** Concatenates two translation */
76
+ inline Translation operator* (const Translation& other) const
77
+ { return Translation(m_coeffs + other.m_coeffs); }
78
+
79
+ /** Concatenates a translation and a scaling */
80
+ inline TransformType operator* (const ScalingType& other) const;
81
+
82
+ /** Concatenates a translation and a linear transformation */
83
+ inline TransformType operator* (const LinearMatrixType& linear) const;
84
+
85
+ template<typename Derived>
86
+ inline TransformType operator*(const RotationBase<Derived,Dim>& r) const
87
+ { return *this * r.toRotationMatrix(); }
88
+
89
+ /** Concatenates a linear transformation and a translation */
90
+ // its a nightmare to define a templated friend function outside its declaration
91
+ friend inline TransformType operator* (const LinearMatrixType& linear, const Translation& t)
92
+ {
93
+ TransformType res;
94
+ res.matrix().setZero();
95
+ res.linear() = linear;
96
+ res.translation() = linear * t.m_coeffs;
97
+ res.matrix().row(Dim).setZero();
98
+ res(Dim,Dim) = Scalar(1);
99
+ return res;
100
+ }
101
+
102
+ /** Concatenates a translation and an affine transformation */
103
+ inline TransformType operator* (const TransformType& t) const;
104
+
105
+ /** Applies translation to vector */
106
+ inline VectorType operator* (const VectorType& other) const
107
+ { return m_coeffs + other; }
108
+
109
+ /** \returns the inverse translation (opposite) */
110
+ Translation inverse() const { return Translation(-m_coeffs); }
111
+
112
+ Translation& operator=(const Translation& other)
113
+ {
114
+ m_coeffs = other.m_coeffs;
115
+ return *this;
116
+ }
117
+
118
+ /** \returns \c *this with scalar type casted to \a NewScalarType
119
+ *
120
+ * Note that if \a NewScalarType is equal to the current scalar type of \c *this
121
+ * then this function smartly returns a const reference to \c *this.
122
+ */
123
+ template<typename NewScalarType>
124
+ inline typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type cast() const
125
+ { return typename internal::cast_return_type<Translation,Translation<NewScalarType,Dim> >::type(*this); }
126
+
127
+ /** Copy constructor with scalar type conversion */
128
+ template<typename OtherScalarType>
129
+ inline explicit Translation(const Translation<OtherScalarType,Dim>& other)
130
+ { m_coeffs = other.vector().template cast<Scalar>(); }
131
+
132
+ /** \returns \c true if \c *this is approximately equal to \a other, within the precision
133
+ * determined by \a prec.
134
+ *
135
+ * \sa MatrixBase::isApprox() */
136
+ bool isApprox(const Translation& other, typename NumTraits<Scalar>::Real prec = precision<Scalar>()) const
137
+ { return m_coeffs.isApprox(other.m_coeffs, prec); }
138
+
139
+ };
140
+
141
+ /** \addtogroup Geometry_Module */
142
+ //@{
143
+ typedef Translation<float, 2> Translation2f;
144
+ typedef Translation<double,2> Translation2d;
145
+ typedef Translation<float, 3> Translation3f;
146
+ typedef Translation<double,3> Translation3d;
147
+ //@}
148
+
149
+
150
+ template<typename Scalar, int Dim>
151
+ inline typename Translation<Scalar,Dim>::TransformType
152
+ Translation<Scalar,Dim>::operator* (const ScalingType& other) const
153
+ {
154
+ TransformType res;
155
+ res.matrix().setZero();
156
+ res.linear().diagonal() = other.coeffs();
157
+ res.translation() = m_coeffs;
158
+ res(Dim,Dim) = Scalar(1);
159
+ return res;
160
+ }
161
+
162
+ template<typename Scalar, int Dim>
163
+ inline typename Translation<Scalar,Dim>::TransformType
164
+ Translation<Scalar,Dim>::operator* (const LinearMatrixType& linear) const
165
+ {
166
+ TransformType res;
167
+ res.matrix().setZero();
168
+ res.linear() = linear;
169
+ res.translation() = m_coeffs;
170
+ res.matrix().row(Dim).setZero();
171
+ res(Dim,Dim) = Scalar(1);
172
+ return res;
173
+ }
174
+
175
+ template<typename Scalar, int Dim>
176
+ inline typename Translation<Scalar,Dim>::TransformType
177
+ Translation<Scalar,Dim>::operator* (const TransformType& t) const
178
+ {
179
+ TransformType res = t;
180
+ res.pretranslate(m_coeffs);
181
+ return res;
182
+ }
183
+
184
+ } // end namespace Eigen
@@ -0,0 +1,120 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
5
+ //
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 EIGEN2_LU_H
11
+ #define EIGEN2_LU_H
12
+
13
+ namespace Eigen {
14
+
15
+ template<typename MatrixType>
16
+ class LU : public FullPivLU<MatrixType>
17
+ {
18
+ public:
19
+
20
+ typedef typename MatrixType::Scalar Scalar;
21
+ typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
22
+ typedef Matrix<int, 1, MatrixType::ColsAtCompileTime, MatrixType::Options, 1, MatrixType::MaxColsAtCompileTime> IntRowVectorType;
23
+ typedef Matrix<int, MatrixType::RowsAtCompileTime, 1, MatrixType::Options, MatrixType::MaxRowsAtCompileTime, 1> IntColVectorType;
24
+ typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime, MatrixType::Options, 1, MatrixType::MaxColsAtCompileTime> RowVectorType;
25
+ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1, MatrixType::Options, MatrixType::MaxRowsAtCompileTime, 1> ColVectorType;
26
+
27
+ typedef Matrix<typename MatrixType::Scalar,
28
+ MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" is the number of cols of the original matrix
29
+ // so that the product "matrix * kernel = zero" makes sense
30
+ Dynamic, // we don't know at compile-time the dimension of the kernel
31
+ MatrixType::Options,
32
+ MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter
33
+ MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, whose dimension is the number
34
+ // of columns of the original matrix
35
+ > KernelResultType;
36
+
37
+ typedef Matrix<typename MatrixType::Scalar,
38
+ MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose dimension is the number
39
+ // of rows of the original matrix
40
+ Dynamic, // we don't know at compile time the dimension of the image (the rank)
41
+ MatrixType::Options,
42
+ MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix,
43
+ MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns.
44
+ > ImageResultType;
45
+
46
+ typedef FullPivLU<MatrixType> Base;
47
+
48
+ template<typename T>
49
+ explicit LU(const T& t) : Base(t), m_originalMatrix(t) {}
50
+
51
+ template<typename OtherDerived, typename ResultType>
52
+ bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
53
+ {
54
+ *result = static_cast<const Base*>(this)->solve(b);
55
+ return true;
56
+ }
57
+
58
+ template<typename ResultType>
59
+ inline void computeInverse(ResultType *result) const
60
+ {
61
+ solve(MatrixType::Identity(this->rows(), this->cols()), result);
62
+ }
63
+
64
+ template<typename KernelMatrixType>
65
+ void computeKernel(KernelMatrixType *result) const
66
+ {
67
+ *result = static_cast<const Base*>(this)->kernel();
68
+ }
69
+
70
+ template<typename ImageMatrixType>
71
+ void computeImage(ImageMatrixType *result) const
72
+ {
73
+ *result = static_cast<const Base*>(this)->image(m_originalMatrix);
74
+ }
75
+
76
+ const ImageResultType image() const
77
+ {
78
+ return static_cast<const Base*>(this)->image(m_originalMatrix);
79
+ }
80
+
81
+ const MatrixType& m_originalMatrix;
82
+ };
83
+
84
+ #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS
85
+ /** \lu_module
86
+ *
87
+ * Synonym of partialPivLu().
88
+ *
89
+ * \return the partial-pivoting LU decomposition of \c *this.
90
+ *
91
+ * \sa class PartialPivLU
92
+ */
93
+ template<typename Derived>
94
+ inline const LU<typename MatrixBase<Derived>::PlainObject>
95
+ MatrixBase<Derived>::lu() const
96
+ {
97
+ return LU<PlainObject>(eval());
98
+ }
99
+ #endif
100
+
101
+ #ifdef EIGEN2_SUPPORT
102
+ /** \lu_module
103
+ *
104
+ * Synonym of partialPivLu().
105
+ *
106
+ * \return the partial-pivoting LU decomposition of \c *this.
107
+ *
108
+ * \sa class PartialPivLU
109
+ */
110
+ template<typename Derived>
111
+ inline const LU<typename MatrixBase<Derived>::PlainObject>
112
+ MatrixBase<Derived>::eigen2_lu() const
113
+ {
114
+ return LU<PlainObject>(eval());
115
+ }
116
+ #endif
117
+
118
+ } // end namespace Eigen
119
+
120
+ #endif // EIGEN2_LU_H
@@ -0,0 +1,71 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
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_LAZY_H
11
+ #define EIGEN_LAZY_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \deprecated it is only used by lazy() which is deprecated
16
+ *
17
+ * \returns an expression of *this with added flags
18
+ *
19
+ * Example: \include MatrixBase_marked.cpp
20
+ * Output: \verbinclude MatrixBase_marked.out
21
+ *
22
+ * \sa class Flagged, extract(), part()
23
+ */
24
+ template<typename Derived>
25
+ template<unsigned int Added>
26
+ inline const Flagged<Derived, Added, 0>
27
+ MatrixBase<Derived>::marked() const
28
+ {
29
+ return derived();
30
+ }
31
+
32
+ /** \deprecated use MatrixBase::noalias()
33
+ *
34
+ * \returns an expression of *this with the EvalBeforeAssigningBit flag removed.
35
+ *
36
+ * Example: \include MatrixBase_lazy.cpp
37
+ * Output: \verbinclude MatrixBase_lazy.out
38
+ *
39
+ * \sa class Flagged, marked()
40
+ */
41
+ template<typename Derived>
42
+ inline const Flagged<Derived, 0, EvalBeforeAssigningBit>
43
+ MatrixBase<Derived>::lazy() const
44
+ {
45
+ return derived();
46
+ }
47
+
48
+
49
+ /** \internal
50
+ * Overloaded to perform an efficient C += (A*B).lazy() */
51
+ template<typename Derived>
52
+ template<typename ProductDerived, typename Lhs, typename Rhs>
53
+ Derived& MatrixBase<Derived>::operator+=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
54
+ EvalBeforeAssigningBit>& other)
55
+ {
56
+ other._expression().derived().addTo(derived()); return derived();
57
+ }
58
+
59
+ /** \internal
60
+ * Overloaded to perform an efficient C -= (A*B).lazy() */
61
+ template<typename Derived>
62
+ template<typename ProductDerived, typename Lhs, typename Rhs>
63
+ Derived& MatrixBase<Derived>::operator-=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
64
+ EvalBeforeAssigningBit>& other)
65
+ {
66
+ other._expression().derived().subTo(derived()); return derived();
67
+ }
68
+
69
+ } // end namespace Eigen
70
+
71
+ #endif // EIGEN_LAZY_H
@@ -0,0 +1,169 @@
1
+ // This file is part of Eigen, a lightweight C++ template library
2
+ // for linear algebra.
3
+ //
4
+ // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
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 EIGEN2_LEASTSQUARES_H
11
+ #define EIGEN2_LEASTSQUARES_H
12
+
13
+ namespace Eigen {
14
+
15
+ /** \ingroup LeastSquares_Module
16
+ *
17
+ * \leastsquares_module
18
+ *
19
+ * For a set of points, this function tries to express
20
+ * one of the coords as a linear (affine) function of the other coords.
21
+ *
22
+ * This is best explained by an example. This function works in full
23
+ * generality, for points in a space of arbitrary dimension, and also over
24
+ * the complex numbers, but for this example we will work in dimension 3
25
+ * over the real numbers (doubles).
26
+ *
27
+ * So let us work with the following set of 5 points given by their
28
+ * \f$(x,y,z)\f$ coordinates:
29
+ * @code
30
+ Vector3d points[5];
31
+ points[0] = Vector3d( 3.02, 6.89, -4.32 );
32
+ points[1] = Vector3d( 2.01, 5.39, -3.79 );
33
+ points[2] = Vector3d( 2.41, 6.01, -4.01 );
34
+ points[3] = Vector3d( 2.09, 5.55, -3.86 );
35
+ points[4] = Vector3d( 2.58, 6.32, -4.10 );
36
+ * @endcode
37
+ * Suppose that we want to express the second coordinate (\f$y\f$) as a linear
38
+ * expression in \f$x\f$ and \f$z\f$, that is,
39
+ * \f[ y=ax+bz+c \f]
40
+ * for some constants \f$a,b,c\f$. Thus, we want to find the best possible
41
+ * constants \f$a,b,c\f$ so that the plane of equation \f$y=ax+bz+c\f$ fits
42
+ * best the five above points. To do that, call this function as follows:
43
+ * @code
44
+ Vector3d coeffs; // will store the coefficients a, b, c
45
+ linearRegression(
46
+ 5,
47
+ &points,
48
+ &coeffs,
49
+ 1 // the coord to express as a function of
50
+ // the other ones. 0 means x, 1 means y, 2 means z.
51
+ );
52
+ * @endcode
53
+ * Now the vector \a coeffs is approximately
54
+ * \f$( 0.495 , -1.927 , -2.906 )\f$.
55
+ * Thus, we get \f$a=0.495, b = -1.927, c = -2.906\f$. Let us check for
56
+ * instance how near points[0] is from the plane of equation \f$y=ax+bz+c\f$.
57
+ * Looking at the coords of points[0], we see that:
58
+ * \f[ax+bz+c = 0.495 * 3.02 + (-1.927) * (-4.32) + (-2.906) = 6.91.\f]
59
+ * On the other hand, we have \f$y=6.89\f$. We see that the values
60
+ * \f$6.91\f$ and \f$6.89\f$
61
+ * are near, so points[0] is very near the plane of equation \f$y=ax+bz+c\f$.
62
+ *
63
+ * Let's now describe precisely the parameters:
64
+ * @param numPoints the number of points
65
+ * @param points the array of pointers to the points on which to perform the linear regression
66
+ * @param result pointer to the vector in which to store the result.
67
+ This vector must be of the same type and size as the
68
+ data points. The meaning of its coords is as follows.
69
+ For brevity, let \f$n=Size\f$,
70
+ \f$r_i=result[i]\f$,
71
+ and \f$f=funcOfOthers\f$. Denote by
72
+ \f$x_0,\ldots,x_{n-1}\f$
73
+ the n coordinates in the n-dimensional space.
74
+ Then the resulting equation is:
75
+ \f[ x_f = r_0 x_0 + \cdots + r_{f-1}x_{f-1}
76
+ + r_{f+1}x_{f+1} + \cdots + r_{n-1}x_{n-1} + r_n. \f]
77
+ * @param funcOfOthers Determines which coord to express as a function of the
78
+ others. Coords are numbered starting from 0, so that a
79
+ value of 0 means \f$x\f$, 1 means \f$y\f$,
80
+ 2 means \f$z\f$, ...
81
+ *
82
+ * \sa fitHyperplane()
83
+ */
84
+ template<typename VectorType>
85
+ void linearRegression(int numPoints,
86
+ VectorType **points,
87
+ VectorType *result,
88
+ int funcOfOthers )
89
+ {
90
+ typedef typename VectorType::Scalar Scalar;
91
+ typedef Hyperplane<Scalar, VectorType::SizeAtCompileTime> HyperplaneType;
92
+ const int size = points[0]->size();
93
+ result->resize(size);
94
+ HyperplaneType h(size);
95
+ fitHyperplane(numPoints, points, &h);
96
+ for(int i = 0; i < funcOfOthers; i++)
97
+ result->coeffRef(i) = - h.coeffs()[i] / h.coeffs()[funcOfOthers];
98
+ for(int i = funcOfOthers; i < size; i++)
99
+ result->coeffRef(i) = - h.coeffs()[i+1] / h.coeffs()[funcOfOthers];
100
+ }
101
+
102
+ /** \ingroup LeastSquares_Module
103
+ *
104
+ * \leastsquares_module
105
+ *
106
+ * This function is quite similar to linearRegression(), so we refer to the
107
+ * documentation of this function and only list here the differences.
108
+ *
109
+ * The main difference from linearRegression() is that this function doesn't
110
+ * take a \a funcOfOthers argument. Instead, it finds a general equation
111
+ * of the form
112
+ * \f[ r_0 x_0 + \cdots + r_{n-1}x_{n-1} + r_n = 0, \f]
113
+ * where \f$n=Size\f$, \f$r_i=retCoefficients[i]\f$, and we denote by
114
+ * \f$x_0,\ldots,x_{n-1}\f$ the n coordinates in the n-dimensional space.
115
+ *
116
+ * Thus, the vector \a retCoefficients has size \f$n+1\f$, which is another
117
+ * difference from linearRegression().
118
+ *
119
+ * In practice, this function performs an hyper-plane fit in a total least square sense
120
+ * via the following steps:
121
+ * 1 - center the data to the mean
122
+ * 2 - compute the covariance matrix
123
+ * 3 - pick the eigenvector corresponding to the smallest eigenvalue of the covariance matrix
124
+ * The ratio of the smallest eigenvalue and the second one gives us a hint about the relevance
125
+ * of the solution. This value is optionally returned in \a soundness.
126
+ *
127
+ * \sa linearRegression()
128
+ */
129
+ template<typename VectorType, typename HyperplaneType>
130
+ void fitHyperplane(int numPoints,
131
+ VectorType **points,
132
+ HyperplaneType *result,
133
+ typename NumTraits<typename VectorType::Scalar>::Real* soundness = 0)
134
+ {
135
+ typedef typename VectorType::Scalar Scalar;
136
+ typedef Matrix<Scalar,VectorType::SizeAtCompileTime,VectorType::SizeAtCompileTime> CovMatrixType;
137
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType)
138
+ ei_assert(numPoints >= 1);
139
+ int size = points[0]->size();
140
+ ei_assert(size+1 == result->coeffs().size());
141
+
142
+ // compute the mean of the data
143
+ VectorType mean = VectorType::Zero(size);
144
+ for(int i = 0; i < numPoints; ++i)
145
+ mean += *(points[i]);
146
+ mean /= numPoints;
147
+
148
+ // compute the covariance matrix
149
+ CovMatrixType covMat = CovMatrixType::Zero(size, size);
150
+ for(int i = 0; i < numPoints; ++i)
151
+ {
152
+ VectorType diff = (*(points[i]) - mean).conjugate();
153
+ covMat += diff * diff.adjoint();
154
+ }
155
+
156
+ // now we just have to pick the eigen vector with smallest eigen value
157
+ SelfAdjointEigenSolver<CovMatrixType> eig(covMat);
158
+ result->normal() = eig.eigenvectors().col(0);
159
+ if (soundness)
160
+ *soundness = eig.eigenvalues().coeff(0)/eig.eigenvalues().coeff(1);
161
+
162
+ // let's compute the constant coefficient such that the
163
+ // plane pass trough the mean point:
164
+ result->offset() = - (result->normal().cwise()* mean).sum();
165
+ }
166
+
167
+ } // end namespace Eigen
168
+
169
+ #endif // EIGEN2_LEASTSQUARES_H