My only complaint is that using OpenMP Eigen can be slower with SMT than without SMT. They even suggest telling to use half as many threads as you have "cores" when "cores" means twice as many due to SMT. Otherwise, we've seen a 8-10x performance increase in SolveSpace (CAD) in some situations after switching from home-grown matrix operations to Eigen.
Eigen: A C++ template library for linear algebra
61–70 of 85 posts
Re: Eigen: A C++ template library for linear algebra
#62God bless Eigen, I am using it to implement the state matrices of a Kalman Filter and it's a joy to use its APIs.
Eigen has one of if not the best linear algebra APIs I've ever seen. In particular, vectors are column vectors by default and you never need to touch row vectors (if I can editorialize, row vectors shouldn't exist at all), and vectors are not simply "n-by-1" matrices -- they're true vectors.
But tge nice part is that these vectors can still interact well with parts of the code that expect a matrix.
Re: Eigen: A C++ template library for linear algebra
#63Eigen is really nice for getting code that looks like the underlying math and it also optimizes away unnecessary temporaries by using template expressions. However, when you mess up, you get a screen full of template errors that take some experience to understand and debug. It makes me wish for a language + compiler where linear algebraic objects are first-class values.
> It makes me wish for a language + compiler where linear algebraic objects are first-class values. Like Fortran?
Re: Eigen: A C++ template library for linear algebra
#64Re: Eigen: A C++ template library for linear algebra
#65Is there anything like Eigen for data that's kept on the GPU? I've been looking at porting some performance-critical scientific computing code from Python to C++ and numpy -> Eigen seems like an obvious migration path, but it's harder to figure out what to do with cupy matrix operations.
It wraps Vulkan in a very thin layer, mostly to eliminate boilerplate.
Re: Eigen: A C++ template library for linear algebra
#66Re: Eigen: A C++ template library for linear algebra
#67Eigen is the standard choice (for good reason!) for many linear algebra projects, especially in robotics, but there is a big downside users should be aware of before they chose it. Eigen makes extensive use of expression templates in C++ to collapse complex operation sequences into streamlined and minimal calculations. This is generally ok, until you need a debug build. I've regularly seen debug builds of software us…
In debug mode it has no notion of performance whatsoever.
Re: Eigen: A C++ template library for linear algebra
#68Re: Eigen: A C++ template library for linear algebra
#69Earlier quoted context omitted.
I wonder how Eigen compares to xtensor, which was inspired by Numpy and has support for views, slicing, and broadcasting? https://github.com/xtensor-stack/xtensor
Eigen is similar to xtensor, but with 1) Eigen being significantly more mature, and used in production in simulation/research environments and 2) Eigen having not just basic operations on arrays, but also a full suite of linear algebra operations comparable to a full BLAS library, including a full test suite. xtensor wins on having better integration with Python and other languages out of the box. There's also some p…
Re: Eigen: A C++ template library for linear algebra
#70Eigen is the standard choice (for good reason!) for many linear algebra projects, especially in robotics, but there is a big downside users should be aware of before they chose it. Eigen makes extensive use of expression templates in C++ to collapse complex operation sequences into streamlined and minimal calculations. This is generally ok, until you need a debug build. I've regularly seen debug builds of software us…