Re: Initializing from an initializer_list

gsermaid <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <[email protected]>
Thanks for your prompt reply. I was not aware of the ublas::assignment functionalities, I will definitely have a look. 
Σε ευχαριστω.

Regards,
Giorgos


________________________________
 


--
Date: Thu, 9 May 2013 14:38:32 +0100 (BST)
From: gsermaid <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [ublas] Initializing from an initializer_list
Message-ID:
    <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi all,

One feature I would really like to see for ublas vectors is the ability to initialize them from a std::initializer_list, in a similar way to the std::vector.?
This would allow filling in a vector much more easily and help creating test cases more quickly. Are there any plans for such a functionality in a future ublas release?

Best regards
-------------- next part --------------
HTML attachment scrubbed and removed

------------------------------

Message: 2
Date: Thu, 9 May 2013 11:47:34 -0400
From: Nasos Iliopoulos <[email protected]>
To: [email protected]
Subject: Re: [ublas] Initializing from an initializer_list
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

Hello,
I think we should add intializer_lists in the future, since it will help 
with containers that need to be created (and initialized) plenty of times.

For other cases uBlas has an advanced facility that can be used to fill 
a container using a similar format with initializer lists. It is an 
assigner though  rather than initialization facility. The good thing is 
that it can be used to fill the container with either scalars, vectors 
or matrices,  navigate while inserting them or define insertion 
traversal policies like by row or by column (features that an 
initiliazer list cannot have). It also covers special operations for 
sparse containers so that the insertion is fast in those cases as well.

You can do this: (A a matrix)
A <<= 0, 1, 2,
          3, 4, 5,
          6, 7, 8;

But also this:
   A <<= 0, 1, 2,
          a,
          3, 4, 5; // a is a 3-vector here

or even:
     B <<= A, A,
          A, A;
     std::cout << B << std::endl;
     // [ A A ]
     // [ A A ]

I am still to write the  documentation for  ublas:assignment but I think 
the examples pretty much cover most of the functionality:
http://svn.boost.org/svn/boost/trunk/libs/numeric/ublas/doc/samples/assignment_examples.cpp

The unit tests cover some additional items:
http://svn.boost.org/svn/boost/trunk/libs/numeric/ublas/test/test_assignment.cpp

Some benchmarks are here:
http://svn.boost.org/svn/boost/trunk/libs/numeric/ublas/bench5/

Regards,
-Nasos



On 05/09/2013 09:38 AM, gsermaid wrote:
> Hi all,
>
> One feature I would really like to see for ublas vectors is the 
> ability to initialize them from a std::initializer_list, in a similar 
> way to the std::vector.
> This would allow filling in a vector much more easily and help 
> creating test cases more quickly. Are there any plans for such a 
> functionality in a future ublas release?
>
> Best regards
>
>
> _______________________________________________
> ublas mailing list
> [email protected]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: [email protected]

-------------- next part --------------
HTML attachment scrubbed and removed

------------------------------

Subject: Digest Footer

_______________________________________________
ublas mailing list
[email protected]
http://lists.boost.org/mailman/listinfo.cgi/ublas


------------------------------

End of ublas Digest, Vol 102, Issue 4
*************************************

_______________________________________________
ublas mailing list
[email protected]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.