Boost logo

Ublas :

Subject: Re: [ublas] [feature request] new free functions for matrix/vector sizes
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-09-20 13:27:15

On Wed, Sep 16, 2009 at 9:52 AM, Marco Guazzone
<marco.guazzone_at_[hidden]> wrote:
> On Mon, Sep 14, 2009 at 9:50 PM, Gunter Winkler <guwi17_at_[hidden]> wrote:
>> Hello uBLAS community,
>> I created a new feature request which summarizes the current discussion.
>> I think that we found a usable conclusion. Is there any one going to
>> take the task. I will collect the corresponding patches and commit them
>> to the SVN.
>> It would be nice to finish this until end of September in order to have
>> this feature in release 1.41.
> I'll try to make my best.
> However I cannot give any guarantees since I've some deadlines for my
> research work too ;)


I've tried to implement these features plus the begin/end operation.
* size:
  - size(v)
  - size<1>(v)
  - size<1>(M)
  - size<2>(M)
  - size<tag::major>(M)
  - size<tag::minor>(M)
  - size<tag::leading>(M)
* num_columns
  - num_columns(M)
* num_rows
  - num_rows(M)
* begin:
  - begin(v) ==> alias of v.begin()
  - begin<tag::major>(M) ==> alias of M.begin1() or M.begin2()
[according to the orientation]
  - begin<tag::minor>(M) ==> alias of M.begin2() or M.begin2()
[according to the orientation]
  - begin(outer_mat_iter) ==> alias of outer_mat_iter.begin()
* end:
  - end(v) ==> alias of v.end()
  - end<tag::major>(M) ==> alias of M.end1() or M.end2() [according to
the orientation]
  - end<tag::minor>(M) ==> alias of M.end2() or M.end2() [according to
the orientation]
  - end(outer_mat_iter) ==> alias of outer_mat_iter.end()
* iterator_type
  - iterator_type<VectorExpression>::type ==> alias of
  - iterator_type<MatrixExpression>::type ==> alias of
MatrixExpression::iterator1 or MatrixExpression::iterator2 [according
to the orientation]
* const_iterator_type
  - const_iterator_type<VectorExpression>::type ==> alias of
  - const_iterator_type<MatrixExpression>::type ==> alias of
MatrixExpression::const_iterator1 or MatrixExpression::const_iterator2
[according to the orientation]

you will find one header for each operation.
Note: I like to have one header for each operation because (1) the
user can include only the needed headers, (2) the resulting compiled
file should be smaller, (3) make the code clearer. Anyway, you're free
to put all of them in a single header.

there various tests.
You can compile them through the make file which I've provided.

All the code has been successfully compiled with GCC 4.4.1 on Fedora
11 x86_64, with very paranoic flags (like -Wall -Wextra -ansi
-pedantic): no errors nor warnings.

Since I'm very a beginner in template meta-programming, I would very
appreciate any hint/suggestion/comment for improving the code and my
knowledge about C++ ;)

PS: Should I post the code in the Trac site? If I do, how? I've
noticed the Login link ask me a login/password credentials...which I
have not :)

Thank you!!


-- Marco