Boost logo

Ublas :

Subject: Re: [ublas] Initializing from an initializer_list
From: gsermaid (linuxfever_at_[hidden])
Date: 2013-05-10 04:42:46


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 <linuxfever_at_[hidden]> To: "ublas_at_[hidden]" <ublas_at_[hidden]> Subject: [ublas] Initializing from an initializer_list Message-ID:     <1368106712.65540.YahooMailNeo_at_[hidden]> 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 <nasos_i_at_[hidden]> To: ublas_at_[hidden] Subject: Re: [ublas] Initializing from an initializer_list Message-ID: <BLU0-SMTP164BA137EB50FAEFD1C00A099A40_at_phx.gbl> 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 > ublas_at_[hidden] > http://lists.boost.org/mailman/listinfo.cgi/ublas > Sent to: athanasios.iliopoulos.ctr.gr_at_[hidden] -------------- next part -------------- HTML attachment scrubbed and removed ------------------------------ Subject: Digest Footer _______________________________________________ ublas mailing list ublas_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/ublas ------------------------------ End of ublas Digest, Vol 102, Issue 4 *************************************