Boost logo

Ublas :

Subject: Re: [ublas] Conflicting operator == in ublas
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2008-12-10 15:15:20

Am Mittwoch, 10. Dezember 2008 14:42 schrieb K.M.A.Chai_at_[hidden]:
> Hi,
> The following
> grep -R "operator ==" ublas/* | grep -v "iterator"
> produces, for example:
> ublas/detail/concepts.hpp:718:
> operator == (const vector_expression<E1> &e1, const
> vector_expression<E2> &e2) {
> and
> ublas/matrix_proxy.hpp:180:
> bool operator == (const matrix_row &mr) const {
> It seems that the definition of operator== in the proxies does not
> agree with the concept.
> For example, in matrix_row, which is derived from a
> vector_expression, two rows are equal iff they are the same indexes
> into the same matrices. This conflicts the definition in
> ublas/detail/concept, where it is stated that two vectors are equal
> if their norm_inf are zero.

The operator== () is not part of the vector expression concept. Thus
vector expressions do not need to provide it. The operator==() of some
proxies is only provided for convenience and means "points to the same
location". It does not mean "has the same entries".

The operator==() in concepts.hpp is only provided to simplify the syntax
of the rules to be checked. It is not provided for general use.