Boost logo

Ublas :

Subject: Re: [ublas] fixed size vector in boost::numeric::ublas?
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2010-07-23 15:43:26


Vardan,
thanx for the insight!

In such a case I suppose we can go by changing the vector concept by removing the resize(), and extend it by a dynamic_vector concept that includes the resize, I think in that way nothing breaks (of course the containers that refine it and all the algorithms need to also follow). The magnitude of the changes should be manageable.

Furthermore AFAIK there is no hard-concept checking into uBlas, so making the changes into the main code should be straightforward.

Best
Nasos

> From: vakopian_at_[hidden]
> Date: Fri, 23 Jul 2010 12:00:09 -0700
> To: ublas_at_[hidden]
> Subject: Re: [ublas] fixed size vector in boost::numeric::ublas?
>
> On Fri, Jul 23, 2010 at 5:23 AM, Nasos Iliopoulos <nasos_i_at_[hidden]> wrote:
> >
> > If I remember well from my implelentation the major decision that has to be made relates to the resize(..) member function. Since the fixed types cannot resize it would seem obvious that those functions should not be implemented at all, but I think uBlas is using it in some algorithms, so either the algorithms need to be specialized, or the the fixed type resize function needs to be implements as an empty function. I think the first option is the best.
> >
>
> The idea of a fixed size vector has been discussed multiple times on
> this list over the years. Typically it has been rejected because the
> Vector Concept (as per
> http://www.boost.org/doc/libs/1_43_0/libs/numeric/ublas/doc/container_concept.htm#vector
> ), defines the resize() method. Moreover it has a post condition
> v.size () == n. So not having an implementation would break the
> concept, having an empty implementation would break the concept's post
> condition. A third option is to throw an exception (saying that it
> cannot be resized). I'm not sure if throwing an exception technically
> breaks the concept. If it does not, then we're fine. Otherwise, we
> should either consider changing the concept, or agree that
> fixed_vector does not implement the Vector concept (in which case
> naming it a "..._vector" is somewhat misleading).
>
> -Vardan
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: nasos_i_at_[hidden]
                                               
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1