|
Ublas : |
Subject: Re: [ublas] A ublas::tie to vector expressions?
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2010-07-15 08:21:38
I opened a ticket to track this task,
https://svn.boost.org/trac/boost/ticket/4436
I agree that we need to think a bit about how it will be integrated, since per David's post there are interesting operations like returning vectors from matrices.
Jesse, you can upload your files in the trac if you like.
Best
Nasos
From: jesseperla_at_[hidden]
Date: Thu, 15 Jul 2010 08:02:57 -0400
To: ublas_at_[hidden]
Subject: Re: [ublas] A ublas::tie to vector expressions?
Nasos Iliopoulos <nasos_i <at> hotmail.com> writes:> That would be very useful indeed and not hard to generalize.
Oops, I sent in my test file and not the implementation. I decided to learn a little boost preprocessor, so the attached file may be a complete implementation of the vector expression tie for a compile time constant size. My test file is also attached, but if you want to use it you will have to change around the includes, etc.
The test file succeeds with MSVC10 and Intel 11.1 on Windows. I am sure it could be made more efficient... The main issue I have is forcing default constructible on the value-types, which you will see if you go through the code. I suppose that helpers of different sizes could be generated instead of my trick with the mpl::void_, but I really didn't want to debug that PP iteration.
Alas, I would love to use variable argument templates, but it is one of the C++0X features that just isn't widely available enough yet. I use auto, decltype, and C++0X lambdas all the time in my 2 windows compilers, but the variable argument templates will be > 1 year for MSVC and Intel.
How would the notation for tie'ing for matrices work? Would it be to scalars of just vectors? I can visualize something like the following:ublas::vector<double> v0(2);
ublas::vector<double> v1(2);ublas::matrix<double> m(2,2);
ublas::tie_by_column(v0, v1) = m;ublas::tie_by_row(v0, v1) = m;
My gut is that the notation should be more consistent with the new assignment operators, etc. in ublas, but I am not sure I know how.
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4