This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Comparison to uBLAS

Tags: None
(comma "," separated)
penguian
Registered Member
Posts
9
Karma
0
OS

Comparison to uBLAS

Tue Feb 24, 2009 1:58 pm
Hi all. Right now, I'm continuing the development of the Glucat C++ template library for Clifford algebras -- http://glucat.sf.net . GluCat is currently based on uBLAS. Has anyone done a comparison of Eigen to uBLAS? I want to know how much code I will need to write myself to cover features of uBLAS which are missing from Eigen.

For example:
(1) Do Eigen matrices have iterators which resemble the uBLAS row and column iterators? If so, is it possible to iterate over all structural non-zeros of a sparse matrix?

(2) In Eigen, is it possible to assign a dense matrix to a sparse matrix, and if so, can the result ever contain structural zeros? How about binary operations between sparse and dense matrices?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

RE: Comparison to uBLAS

Wed Feb 25, 2009 1:57 am
penguian wrote:Hi all. Right now, I'm continuing the development of the Glucat C++ template library for Clifford algebras -- http://glucat.sf.net . GluCat is currently based on uBLAS. Has anyone done a comparison of Eigen to uBLAS? I want to know how much code I will need to write myself to cover features of uBLAS which are missing from Eigen.


yes, Eigen is consistently faster ;) About features, the sparse module is still under heavy development but I think that most features are already there. However, unlike uBlas, we won't make available features which cannot be optimally implemented. For instance: "dense1 = dense2 + sparse3" is one example because the optimal way to do it is:

dense1 = dense2;
dense1 += sparse3;

however "dense1 += sparse3;" is one the rare operations which are not implemented yet :(


For example:
(1) Do Eigen matrices have iterators which resemble the uBLAS row and column iterators? If so, is it possible to iterate over all structural non-zeros of a sparse matrix?


yes, I recommend you to get the svn trunk and generate the doxygen doc and read the sparse tutorial:

mkdir build
cd build
cmake path_to_eigen_source
make doc
open doc/html/SparseTutorial.html

(2) In Eigen, is it possible to assign a dense matrix to a sparse matrix, and if so, can the result ever contain structural zeros? How about binary operations between sparse and dense matrices?


for "sparse = dense" this is not available yet because this not very useful. in most cases sparse matrices are just too large to have any dense equivalent. But I'll add it soon, this is trivial, and yes the result will contain the structural 0, otherwise that would be very useless !

"about binary operations between sparse and dense matrices?" see my previous comment.

actually it seems you are asking for the very rare features which are not implemented yet !
Seb
Registered Member
Posts
99
Karma
0

RE: Comparison to uBLAS

Wed Feb 25, 2009 2:36 pm
From my experience, Eigen can be ported sharing the source with uBlas.

You can apply Eigen::Map to &(uBlasObject.data()[0]) buffers. In that way you can use uBlas objects while start porting the algorithms to Eigen.

The concept of iterators is a little different (see Eigen::InnerIterator), but it is more consistent when dealing with row and column major objects (in uBlas the iterator1 and iterator2 changed their direction with the memory layout). moreover, they are way faster when dealing with sparse matrices!

Geal and I discussed many concerns you mentioned during my own porting process from uBlas in the thread "bindungs to other libs".

For me, Eigen feels more natural. You do not need to worry about "noalias()" operations to speed up things and you do not have to make you own benchmarks in order to find out the fastest marix-vector product. (axpy_prod, ublas::prod etc.)
Royi
Registered Member
Posts
34
Karma
0

Re: Comparison to uBLAS

Sun Jul 02, 2017 2:38 pm
Hi,

How things are now?
Is Eigen still faster for small to medium size matrices?

As it seems uBLAS is faster:

https://bitbucket.org/blaze-lib/blaze/wiki/Benchmarks


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]