|
Ublas : |
Subject: Re: [ublas] rvalue reference and move
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2010-05-26 08:24:05
Of course I could,
but there are two issues here:
1. What is described by Dave Abrahams in his post http://cpp-next.com/archive/2009/09/making-your-next-move/ (which is a matrix library with r-value semantics as an operating mechanism).
2. How ublas can be affected directly by employing r-value functionality.
The code I have right now refers to the first and is by no means complete or anything. It is a basic experimentation with some benchmarks and I don't find how it can directly affect ublas. I will try to clean it up and post it though because it could save some time from people that want to experiment too.
Concerning the second:
The added value I find from r-value reference is the fact that we will be able to get rid of temporaries. This would mean that it is possible to do things like prod(a,prod(b,prod(c,d))), without temporaries. Also ublas no-alias will be probably not needed anymore. All those have ONLY SYNTACTIC relationship with what is described in Dave Abraham's post and with the code I have been experimenting.
Getting some initial benefits from r-value references in ublas is not as difficult, we just have to be very very careful in re-designing constructors and assignment operations. My only concern is that we may have to deal with some combinatorial issues.
Best
Nasos
From: david.bellot_at_[hidden]
Date: Wed, 26 May 2010 13:33:42 +0200
To: ublas_at_[hidden]
Subject: Re: [ublas] rvalue reference and move
Hi Nasos,
can you post the code on the list directly, so that we can all benefit from it.
My only concern is the support of old compilers. Let's have an experimental branch for that and see what we can do.
But it sounds a good idea.
Cheers,
David
On Sat, May 22, 2010 at 20:22, Michael Chen <sth4nth_at_[hidden]> wrote:
Nasos,
Cool, I'd like to try your code. where can I get it?
Best,
Mo
On Sun, May 23, 2010 at 1:52 AM, Nasos Iliopoulos <nasos_i_at_[hidden]> wrote:
> Mo,
> that's why I was talking about expression expansion in the post. This could
> be performed on a dynamic manner, rather than a static manner (as
> expressions are currently implemented). Of course this is a big paradigm
> shift and unless it is thoroughly investigated ublas should probably stay
> away from it. Anyway, if somebody is interested I think I have some code
> lying around playing with r-value stuff (it needs a compiler that supports
> the new standard).
>
> Best
> Nasos.
>
>> Date: Sun, 23 May 2010 01:40:48 +0800
>> From: sth4nth_at_[hidden]
>> To: ublas_at_[hidden]
>> Subject: Re: [ublas] rvalue reference and move
>>
>> Nasos,
>> The example showed in that link does not entirely eliminate
>> temporaries. Consider the expression
>> x = (a+b)+(c+d);
>> here we construct two temporaries and one is wasted.
>>
>> However, I don't think we should re-implement the operators, since
>> those are already handled by expression template. I think only move
>> constructor and move assignment operator should be added for
>> container of uBlas.
>>
>> Best,
>> Mo
>>
>> On Sat, May 22, 2010 at 10:56 PM, Nasos Iliopoulos <nasos_i_at_[hidden]>
>> wrote:
>> > Mo,
>> > in your compile options use BOOST_UBLAS_MOVE_SEMANTICS.
>> >
>> > (i.e. in gcc that would be -DBOOST_UBLAS_MOVE_SEMANTICS)
>> >
>> > I would like to make a couple of changes in the bounded types and push
>> > the
>> > idea to make the move_semantics default, as it seems all compilers
>> > support
>> > copy elision and even if they don't there is no penalty.
>> >
>> > see also:
>> > http://www.boost.org/doc/libs/1_43_0/libs/numeric/ublas/doc/options.htm
>> >
>> > There had been some discussion in the past and I see that with the new
>> > standard we will be able to go even further in totally eliminating
>> > temporaries.
>> > Take a look at this also:
>> > http://cpp-next.com/archive/2009/09/making-your-next-move/
>> >
>> > Best
>> > Nasos
>> >
>> >> Date: Sat, 22 May 2010 15:39:08 +0800
>> >> From: sth4nth_at_[hidden]
>> >> To: ublas_at_[hidden]
>> >> Subject: [ublas] rvalue reference and move
>> >>
>> >> Since gcc 4.4 4.5 and VC2010 all support the rvalue reference, I think
>> >> it will be beneficial to utilize this feature to implement the move
>> >> semantic for those containers of uBlas. Is there any plan for this or
>> >> anyone doing this?
>> >>
>> >> Regards,
>> >> Mo
>> >> _______________________________________________
>> >> ublas mailing list
>> >> ublas_at_[hidden]
>> >> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> >> Sent to: nasos_i_at_[hidden]
>> >
>> > ________________________________
>> > The New Busy is not the old busy. Search, chat and e-mail from your
>> > inbox.
>> > Get started.
>> > _______________________________________________
>> > ublas mailing list
>> > ublas_at_[hidden]
>> > http://lists.boost.org/mailman/listinfo.cgi/ublas
>> > Sent to: sth4nth_at_[hidden]
>> >
>> _______________________________________________
>> 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.
> Learn more.
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: sth4nth_at_[hidden]
>
_______________________________________________
ublas mailing list
ublas_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: david.bellot_at_[hidden]
-- David Bellot, PhD david.bellot_at_[hidden] http://david.bellot.free.fr _________________________________________________________________ The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5