Boost logo

Boost :

Subject: Re: [boost] [gsoc18][ublas] Proposal to add advanced matrix operations
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2018-01-22 10:16:55


Hi David, Rajaditya, Artyom, Shikhar,

> On 21. Jan 2018, at 13:00, David Bellot via Boost <boost_at_[hidden]> wrote:
>
> - yes uBLAS is slow. Not only needs it a support for hardware acceleration
> but also it needs to be more modern (C++11/14/17) and its architecture
> could be much more improved. This would help integrating hardware
> acceleration, IMHO.

I am surprised that no one here mentioned Eigen, an IMHO excellent high-level header-only C++ library to do matrix-vector calculations.

http://eigen.tuxfamily.org/index.php?title=Main_Page <http://eigen.tuxfamily.org/index.php?title=Main_Page>

It uses expression templates to re-structure the expressions written by users to fast optimised code. It supports both matrices with dimensions known at compile-time and at run-time, and supports mixed versions, e.g. one dimension fixed the other dynamic.

According to their own (admittedly, a bit outdated) benchmarks, they are extremely competitive, either on par or even beating $$$ closed-source libraries.

http://eigen.tuxfamily.org/index.php?title=Benchmark <http://eigen.tuxfamily.org/index.php?title=Benchmark>

Eigen tracks its own performance, so you don't need to worry about it getting slower, but perhaps the others have gotten faster in the meantime.

http://eigen.tuxfamily.org/index.php?title=Performance_monitoring <http://eigen.tuxfamily.org/index.php?title=Performance_monitoring>

I used the library in projects and it is very convenient. You just write your expressions as you would on paper and let Eigen generate the fastest possible code out of that. I only dislike that Eigen does not play well with "auto" since C++11, because they use the assignment to a matrix or vector to trigger the evaluation of the expression template.

I haven't done it myself, but Eigen seems to have a good strategy for adding new features, too. People can start to develop their stuff in an "unsupported" subdirectory, which is not meant for production, but the code is nevertheless distributed with Eigen. This helps to exposes the experimental code to more adventurous users. Eventually, a project that passed the test of time can move from "unsupported" to the main library.

Best regards,
Hans


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk