Boost logo

Ublas :

From: Max Weinberg (max.weinberg_at_[hidden])
Date: 2005-05-01 17:08:27

there are some bugs in the current ublas HEAD. compressed_matrix seems to be
quite broken. Writing simply:
compressed_matrix<double> mat(2,1);
mat(1,0) = 1.0;
triggers an assertion. The assertion is most likely wrong.
An amazing result of an addition can be seen here:
compressed_matrix<double> mat(10,3);
mat(6,0) = 1.;
mat(7,1) = 1.;
mat(8,2) = 1.;
mat(9,0) += 42;
After the +=, the ones are compressed into one row. I guess something is wrong
in insert_element, but I don't understand it. Shouldn't errors like that be
caught by some unit tests?
I would use the boost release version, but in that the ref() function is
missing, there are other problems with it, and I guess the addition bug is also
in the release version. I would use coordinate_matrix instead of
compressed_matrix just to have anything, but it is absurdly slow. It doesn't
make much sense like that.
More complaints: the ublas docs on the official boost pages are broken. Some
pages don't exist anymore. I am still missing a comparison operator for
matrices (operator==). One more thing that I don't like is that whenever a
sparse_matrix_element is constructed, the default constructor of value_type
will be called, since value_type is a data member of sparse_matrix_element.
This can be quite costly.
Some more bugs are listed below. I noted also a lot of type conversion warnings.
Final words: Right now, I am quite disappointed with ublas and I think the next
thing I will do is to write my own crappy hand-crafted sparse matrix class. At
least I can fix it on my own.
Greetings, Max

matrix_sparse 142 (I reported this before)
        // Conversion to reference - may be invalidated
        value_type& ref () const {
            pointer p = (*this) ().find_element (i_, j_);
            if (!p)
                p=&(*this) ().insert_element (i_, j_, value_type/*zero*/());
            return *p;

matrix_sparse 3807
    template<class T, class L, std::size_t IB, class IA, class TA>
        const typename compressed_matrix<T, L, IB, IA, TA>::value_type
compressed_matrix<T, L, IB, IA, TA>::zero_=
                compressed_matrix<T, L, IB, IA, TA>::value_type ();

fwd: must be struct basic_full; struct basic_lower;