Boost logo

Ublas :

From: Shawn D. Pautz (sdpautz_at_[hidden])
Date: 2005-10-19 09:10:11


All,

It's my understanding that a generic programming concept specifies the
minimum requirements for a class modeling that concept that clients
(e.g. algorithms) may need. The situation I described below seems to
indicate that lu_factorize needs the find2 member function, either
directly or through calls that it makes. Am I correct in understanding
then that the "M" template parameter of lu_factorize (i.e. the M
concept) must provide find2? Then either the Matrix concept must
require find2, or M is a refinement of Matrix that makes additional
requirements.

More generally, can we assume that the various ublas algorithms are
designed to work with any containers modeling the Vector or Matrix
concept? It seems to me that this is the main reason to define those
concepts in the first place. I would like to use my own Vector and
Matrix types in some situations, and it is far easier to make sure that
these classes have the public interface specified by the documented
concepts than to have to throw them at the various ublas algorithms to
discover what they're missing.

In case this helps to understand my situation, my local classes are
wrappers to bounded_vector and bounded_matrix ("has-a", not "is-a"). I
want to provide only the minimum interface required by the Vector and
Matrix concepts as a means of ensuring that I don't count on extra
functionality, so that I can easily substitute the ublas containers
directly at a later date.

As an aside, has anyone thought of defining similar minimal classes as a
way to test the ublas algorithms (ignore efficiency and concentrate on
the bare interface)? I'm worried that there may have been some feature
creep in both the ublas containers and algorithms which go beyond the
original Vector/Matrix concepts. That's not necessarily a problem, but
if that's happened we should update the definitions of those concepts.

Thanks,
Shawn

Gunter Winkler wrote:

>On Tuesday 18 October 2005 22:51, Shawn D. Pautz wrote:
>
>
>>Does the Matrix concept require a find2 member function? My locally
>>defined matrix class does not work with lu_factorize (with pivots)
>>unless I provide that function. Alternatively, do some of the ublas
>>algorithms have stronger requirements on the matrix classes than defined
>>by the Matrix concept?
>>
>>
>
>Some matrix proxies (row and matrix_vector_range) use find2 to obtain
>iterators pointing to begin and end of the data. To be more precise: nearly
>all (const_)iterators use find to compute pointers to the data.
>
>I don't think find2 should be part of the matrix concept, because it is only
>used internally. But if you create your own matrix class - you have to
>provide this helper function.
>
>mfg
>GuWi
>
>
>

-- 
Shawn D. Pautz
Radiation Transport Department, MS 1179
Sandia National Laboratories
P.O. Box 5800
Albuquerque, NM 87185
Phone: 505-284-4291
Fax: 505-844-0092
E-Mail: sdpautz_at_[hidden]