Eigen 矩阵运算库在实际项目中的使用
生活随笔
收集整理的這篇文章主要介紹了
Eigen 矩阵运算库在实际项目中的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Eigen 矩陣運算庫在實際項目中的使用情況如何?
心血來潮,試了試純模板技術寫的 Eigen 并作了簡單的性能測試,三個 1000 階的方陣連乘運算 Eigen 比 MATLAB 快了一倍,比 OpenCV 快了 2 倍,但是這個庫在實際項目中的穩定性和速度如何我還不大清楚,故有此問。
另外,目前流行的 C++ 數值計算庫很多都使用了 expression template 技術來抑制臨時對象的生成,極大提高了運算性能,但對于同樣使用這個技術的不同的庫,速度卻相差很大,例如 Armadillo,雖然它的底層采用了 BLAS 和 LAPACK,但在上述運算中比 Eigen 慢了整整 4 倍。產生這種現象的原因是什么?
1 條評論 分享
默認排序
按時間排序
8 個回答
7
贊同反對,不會顯示你的姓名
白菜哈哈哈
7 人贊同
總體來說還是Armadillo快些,需要自己設置一下,方法的網上有教程。
下面是Eigen的項目:
Projects using Eigen
Extensions, numerical computation and bindings
Google's Ceres solver is a portable C++ library that allows for modeling and solving large complicated nonlinear least squares problems.
The Manifold ToolKit MTK provides easy mechanisms to enable arbitrary algorithms to operate on manifolds. It also provides a Sparse Least Squares Solver (SLoM) and an Unscented Kalman Filter (UKFoM).
minieigen is small boost::python wrapper for Eigen's core classes (dense fixed and dynamic-sized vectors, matrices, aligned boxes, quaternions; with integer, floating and complex scalars) including operators and subset of Eigen's API methods.
redsvd is a RandomizED Singular Value Decomposition library for sparse or very large dense matrices.
The RcppEigen package provides bindings and more for R.
trustOptim is a trust-region based non linear solver supporting sparse Hessians (C++ implementation with R binding).
sparray: a python binding of the Sparse module - alpha stage.
Shogun: a large scale machine learning toolbox.
Stan: a statistical package based on Eigen that includes a reverse-mode automatic differentiation implementation.
jeigen, a Java wrapper for Eigen.
Science
The Large Survey Synoptic Telescope (website; trac) is a project to build a 3.2Mpixel camera on an 8.4m telescope and survey the entire visible sky every three days.
Gnu Data Language, a GPL interpretor of IDL syntax codes.
The Space Trajectory Analysis project at the European Space Agency. They even have an announcement on using Eigen.
Avogadro, an opensource advanced molecular editor.
The 3D astronomical visualization application Celestia is now using Eigen for all orbital and geometric calculation.
Yade, platform for dynamic particle models, uses Eigen for geometric computations (switched from the WildMagic package)
SLangTNG, an application suite for numerical analysis, linear algebra, advanced statistics, FEM, structural dynamics, data visualization, etc.
Clip, an opensource program for the orientation of Laue exposures.
Multiprecision Computing Toolbox for MATLAB uses Eigen as core library for matrix computations.
Pteros, a C++ library for molecular modeling.
Cufflinks, a tool for transcript assembly, differential expression, and differential regulation for RNA-Sequences.
Vortexje: a GPL library for simulation implementing the source-doublet panel method.
Woo(dem), particle dynamics software (DEM, FEM); Eigen wrapped using minieigen in Python.
Robotics and engineering
The Yujin Robot company uses Eigen for the navigation and arm control of their next gen robots. (switched from blitz, ublas and tvmet)
The Robotic Operating System (ROS) developed by Willow Garage.
openAHRS Open Source IMU / AHRS
The Darmstadt Dribblers autonomous Humanoid Robot Soccer Team and Darmstadt Rescue Robot Team use Eigen for navigation and world modeling.
The Mobile Robot Programming Toolkit (MRPT), a set of libraries for SLAM, localization and computer vision, moved to Eigen (blogannouncement) (switched from home made math classes).
RBDL: a C++ library for rigid body dynamics.
RL a self-contained C++ library for robot kinematics, motion planning and control.
BTK is a Biomechanical ToolKit, licensed under BSD whose primary goal is to propose a set of tools for the analysis of the human body motion which is independent of any acquisition system. It proposes bindings for Matlab/Octave and Python, and a GUI software called Mokka to visualize/analyze 3D/2D motion capture data.
libpointmatcher is a "Iterative Closest Point" library for 3D mapping in robotics.
Computer Graphics
Computational Geometry Algorithms Library (CGAL), a collaborative effort to develop a robust, easy to use, and efficient C++ software library of geometric data structures and algorithms.
Point Cloud Library (PCL), a large scale, BSD licensed, open project for point cloud processing. Uses Eigen as their math backend.
VcgLib, an opensource C++ template library for the manipulation and processing of triangle and tetrahedral meshes. (switched from home made math classes)
MeshLab, an opensource software for the processing and editing of unstructured 3D triangular meshes and point cloud. (switched from vcglib's math classes)
Expe, an experimental framework for the rapid prototyping of graphics applications. No release yet, but it uses 90% of Eigen's features. (switched from home made math classes).
libmv, an opensource structure from motion library. (switched from FLENS)
openMVG a simple library for multiple view geometry.
Google
Google uses Eigen for machine learning, computer vision, and optimization.
In particular, see the mention of Ceres above.
Mobile apps
Layar, an augmented reality appplication for IPhone and Android.
Red Sword Studios, maker of the iPhone games Gradient, Fortress Luna, Stimulus, and Lustre, uses Eigen extensively. Why roll your own matrix/vector/transformation code when there's Eigen?
iPerfectPutt, an iPhone game, uses Eigen for 3D geometry calculations.
KDE (our origins!)
Step, an educational physics simulator.
Koffice2 (KDE's office suite), in particular Krita, the painting and image editing module. Eigen is also used a bit by KSpread, the spreadsheet module, for matrix functions such as MINVERSE, MMULT, MDETERM.
Kalzium uses Eigen indirectly through the aforementioned Avogadro library.
the Mandelbrot wallpaper plugin, some screensavers, kgllib, solidkreator, etc.
Others
WhirlyGlobe a 3D globe component.
編輯于 2014-02-15 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利 收起
2
贊同反對,不會顯示你的姓名
jiahui zhu
2 人贊同
同志,你確定純用Eigen比MATLAB會快?我想知道你是怎么設置的?
我用Eigen+Intel MKL在Release x64模式下也只是跟MATLAB運算速度差不多而已
Visual Studio下實現Eigen+Intel MKL的矩陣乘法
發布于 2016-01-14 1 條評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
知乎用戶數學虐我千百遍,我待數學如初戀;不學c+…
1 人贊同
我依稀記得OpenCV底層支持Eigen,OpenCV在機器視覺領域是王者之一,Eigen的影響力可見一斑。我在自己的項目大量使用Eigen來做數值計算,我覺得Eigen就是方便好用,速度瓶頸主要在算法而不是底層庫。
發布于 2015-11-04 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
2
贊同反對,不會顯示你的姓名
武銳
2 人贊同
顯然openblas比matlab的mkl快。要速度的話,GPU加速吧,至少快5倍。
發布于 2015-05-29 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
Steve Shi
1 人贊同
Benchmark - Eigen
圖中可以看到Eigen和主流的MKL不相上下,實際使用中也有類似的體驗。值得注意的是Eigen的稀疏矩陣處理非常優秀,Armadillo之流無法與之相比。
查看Libmesh才發現,其中也用到了Eigen,在Eigen頁面里沒有提到。
LZ提到比Armadillo快了4倍,我覺得是可能的,Armadillo只是個和matlab長得像的殼子,具體計算還是調用Blas庫來進行運算的,在優化層次上比不上Eigen
發布于 2016-02-24 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
少先隊員團結緊張嚴肅活潑
1 人贊同
如果代碼基本一樣,eigen比arm快,看看底層是具體用的哪個庫做運算,還有編譯選項也很重要,template在-o2和-o0上會完全是兩個速度
發布于 2015-07-18 1 條評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
慕容泊IT
1 人贊同
Armadillo+Openblas的組合更快,而且Armadillo的函數更接近Matlab
發布于 2015-05-06 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
0
贊同反對,不會顯示你的姓名
賈文其
有沒有遇到過這種情況,在用eigen庫的時候用比較大的維數矩陣運算的時候
,會出現這樣的錯誤
發布于 2015-05-06 2 條評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
心血來潮,試了試純模板技術寫的 Eigen 并作了簡單的性能測試,三個 1000 階的方陣連乘運算 Eigen 比 MATLAB 快了一倍,比 OpenCV 快了 2 倍,但是這個庫在實際項目中的穩定性和速度如何我還不大清楚,故有此問。
另外,目前流行的 C++ 數值計算庫很多都使用了 expression template 技術來抑制臨時對象的生成,極大提高了運算性能,但對于同樣使用這個技術的不同的庫,速度卻相差很大,例如 Armadillo,雖然它的底層采用了 BLAS 和 LAPACK,但在上述運算中比 Eigen 慢了整整 4 倍。產生這種現象的原因是什么?
1 條評論 分享
默認排序
按時間排序
8 個回答
7
贊同反對,不會顯示你的姓名
白菜哈哈哈
7 人贊同
總體來說還是Armadillo快些,需要自己設置一下,方法的網上有教程。
下面是Eigen的項目:
Projects using Eigen
Extensions, numerical computation and bindings
Google's Ceres solver is a portable C++ library that allows for modeling and solving large complicated nonlinear least squares problems.
The Manifold ToolKit MTK provides easy mechanisms to enable arbitrary algorithms to operate on manifolds. It also provides a Sparse Least Squares Solver (SLoM) and an Unscented Kalman Filter (UKFoM).
minieigen is small boost::python wrapper for Eigen's core classes (dense fixed and dynamic-sized vectors, matrices, aligned boxes, quaternions; with integer, floating and complex scalars) including operators and subset of Eigen's API methods.
redsvd is a RandomizED Singular Value Decomposition library for sparse or very large dense matrices.
The RcppEigen package provides bindings and more for R.
trustOptim is a trust-region based non linear solver supporting sparse Hessians (C++ implementation with R binding).
sparray: a python binding of the Sparse module - alpha stage.
Shogun: a large scale machine learning toolbox.
Stan: a statistical package based on Eigen that includes a reverse-mode automatic differentiation implementation.
jeigen, a Java wrapper for Eigen.
Science
The Large Survey Synoptic Telescope (website; trac) is a project to build a 3.2Mpixel camera on an 8.4m telescope and survey the entire visible sky every three days.
Gnu Data Language, a GPL interpretor of IDL syntax codes.
The Space Trajectory Analysis project at the European Space Agency. They even have an announcement on using Eigen.
Avogadro, an opensource advanced molecular editor.
The 3D astronomical visualization application Celestia is now using Eigen for all orbital and geometric calculation.
Yade, platform for dynamic particle models, uses Eigen for geometric computations (switched from the WildMagic package)
SLangTNG, an application suite for numerical analysis, linear algebra, advanced statistics, FEM, structural dynamics, data visualization, etc.
Clip, an opensource program for the orientation of Laue exposures.
Multiprecision Computing Toolbox for MATLAB uses Eigen as core library for matrix computations.
Pteros, a C++ library for molecular modeling.
Cufflinks, a tool for transcript assembly, differential expression, and differential regulation for RNA-Sequences.
Vortexje: a GPL library for simulation implementing the source-doublet panel method.
Woo(dem), particle dynamics software (DEM, FEM); Eigen wrapped using minieigen in Python.
Robotics and engineering
The Yujin Robot company uses Eigen for the navigation and arm control of their next gen robots. (switched from blitz, ublas and tvmet)
The Robotic Operating System (ROS) developed by Willow Garage.
openAHRS Open Source IMU / AHRS
The Darmstadt Dribblers autonomous Humanoid Robot Soccer Team and Darmstadt Rescue Robot Team use Eigen for navigation and world modeling.
The Mobile Robot Programming Toolkit (MRPT), a set of libraries for SLAM, localization and computer vision, moved to Eigen (blogannouncement) (switched from home made math classes).
RBDL: a C++ library for rigid body dynamics.
RL a self-contained C++ library for robot kinematics, motion planning and control.
BTK is a Biomechanical ToolKit, licensed under BSD whose primary goal is to propose a set of tools for the analysis of the human body motion which is independent of any acquisition system. It proposes bindings for Matlab/Octave and Python, and a GUI software called Mokka to visualize/analyze 3D/2D motion capture data.
libpointmatcher is a "Iterative Closest Point" library for 3D mapping in robotics.
Computer Graphics
Computational Geometry Algorithms Library (CGAL), a collaborative effort to develop a robust, easy to use, and efficient C++ software library of geometric data structures and algorithms.
Point Cloud Library (PCL), a large scale, BSD licensed, open project for point cloud processing. Uses Eigen as their math backend.
VcgLib, an opensource C++ template library for the manipulation and processing of triangle and tetrahedral meshes. (switched from home made math classes)
MeshLab, an opensource software for the processing and editing of unstructured 3D triangular meshes and point cloud. (switched from vcglib's math classes)
Expe, an experimental framework for the rapid prototyping of graphics applications. No release yet, but it uses 90% of Eigen's features. (switched from home made math classes).
libmv, an opensource structure from motion library. (switched from FLENS)
openMVG a simple library for multiple view geometry.
Google uses Eigen for machine learning, computer vision, and optimization.
In particular, see the mention of Ceres above.
Mobile apps
Layar, an augmented reality appplication for IPhone and Android.
Red Sword Studios, maker of the iPhone games Gradient, Fortress Luna, Stimulus, and Lustre, uses Eigen extensively. Why roll your own matrix/vector/transformation code when there's Eigen?
iPerfectPutt, an iPhone game, uses Eigen for 3D geometry calculations.
KDE (our origins!)
Step, an educational physics simulator.
Koffice2 (KDE's office suite), in particular Krita, the painting and image editing module. Eigen is also used a bit by KSpread, the spreadsheet module, for matrix functions such as MINVERSE, MMULT, MDETERM.
Kalzium uses Eigen indirectly through the aforementioned Avogadro library.
the Mandelbrot wallpaper plugin, some screensavers, kgllib, solidkreator, etc.
Others
WhirlyGlobe a 3D globe component.
編輯于 2014-02-15 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利 收起
2
贊同反對,不會顯示你的姓名
jiahui zhu
2 人贊同
同志,你確定純用Eigen比MATLAB會快?我想知道你是怎么設置的?
我用Eigen+Intel MKL在Release x64模式下也只是跟MATLAB運算速度差不多而已
Visual Studio下實現Eigen+Intel MKL的矩陣乘法
發布于 2016-01-14 1 條評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
知乎用戶數學虐我千百遍,我待數學如初戀;不學c+…
1 人贊同
我依稀記得OpenCV底層支持Eigen,OpenCV在機器視覺領域是王者之一,Eigen的影響力可見一斑。我在自己的項目大量使用Eigen來做數值計算,我覺得Eigen就是方便好用,速度瓶頸主要在算法而不是底層庫。
發布于 2015-11-04 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
2
贊同反對,不會顯示你的姓名
武銳
2 人贊同
顯然openblas比matlab的mkl快。要速度的話,GPU加速吧,至少快5倍。
發布于 2015-05-29 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
Steve Shi
1 人贊同
Benchmark - Eigen
圖中可以看到Eigen和主流的MKL不相上下,實際使用中也有類似的體驗。值得注意的是Eigen的稀疏矩陣處理非常優秀,Armadillo之流無法與之相比。
查看Libmesh才發現,其中也用到了Eigen,在Eigen頁面里沒有提到。
LZ提到比Armadillo快了4倍,我覺得是可能的,Armadillo只是個和matlab長得像的殼子,具體計算還是調用Blas庫來進行運算的,在優化層次上比不上Eigen
發布于 2016-02-24 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
少先隊員團結緊張嚴肅活潑
1 人贊同
如果代碼基本一樣,eigen比arm快,看看底層是具體用的哪個庫做運算,還有編譯選項也很重要,template在-o2和-o0上會完全是兩個速度
發布于 2015-07-18 1 條評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
1
贊同反對,不會顯示你的姓名
慕容泊IT
1 人贊同
Armadillo+Openblas的組合更快,而且Armadillo的函數更接近Matlab
發布于 2015-05-06 添加評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
0
贊同反對,不會顯示你的姓名
賈文其
有沒有遇到過這種情況,在用eigen庫的時候用比較大的維數矩陣運算的時候
,會出現這樣的錯誤
發布于 2015-05-06 2 條評論 感謝 分享 收藏 ? 沒有幫助 ? 舉報 ? 作者保留權利
總結
以上是生活随笔為你收集整理的Eigen 矩阵运算库在实际项目中的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Multi-band Blending
- 下一篇: 在Android Studio上进行Op