Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-06-28 11:01:39


Hallo Gunter,

On Friday 24 June 2005 13:38, Gunter Winkler wrote:
> Hallo,
>
> the bug found by Vardan was caused by a wrong implementation of operator +=
> () and operator -= () of matrix_binary. The increment and decrement
> operators were already dispatched depending on the underlying iterator
> types, but the += and -= had the old behavior. The patch includes the quick
> fix to call ++ or -- as often as requested.

I'm not sure if I should commit this now or wait for the full fix. I'm not
sure what efficiency we will loose in the common cases. If += is commonly
used then fix will really slow some things down.

> A better fix would dispatch +=
> the same way as ++ and optimize it accordingly. Any volunteer?

Not today!

Previously you commented
> the assignment is dispatched to the packed_proxy case, but IMHO it should be
> dispatched to the dense proxy case. (AFAIK banded * dense gives dense?)

My feeling is the way that iterator_category works is wrong.

In binary operations it is used for two purposes:

1. To find the a conservative way to iterate over its two operands to compute
an element in the result. This requires the most general algorithm is chosen.
e.g. dense container + sparse container -> SPARSE algorithm required to
iterate over RHS
This is achieved using iterator_restrict_traits

2. To define the type of the iterator. This is the same purpose Containers and
other expression type use it for. For example iterator_category is used to
choose assignment algorithms.
In this case the way that the two iterators in a binary expression combine is
different from above
e.g. dense container + sparse container -> DENSE container

I think this can be fixed. 'iterator_category' should only be used for the
latter purpose. We need to implement combination rules however. For the
former purepose we can use iterator_restrict_traits directly.

Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________