Re: Problem creating mapping from string to vector_expression

Nasos Iliopoulos via ublas <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <CY4PR22MB0086A2CE4ACE336EC6F5557B99340@CY4PR22MB0086.namprd22.prod.outlook.com>
It would be kind of convolved to try to cast an ublas vector to a vector expression. Will the following achieve what you want?


#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <unordered_map>
#include <string>
#include <iostream>


int main()
{
    std::unordered_map<std::string, boost::numeric::ublas::vector<int> > c;

    boost::numeric::ublas::vector<int> v (10);
    for (unsigned i = 0; i < v.size (); ++ i)
        v (i) = i;

    c["first"] = v;

    std::cout << c["first"] << std::endl;
    return 0;
}


On 03/30/2017 09:30 AM, SHIVAM MITTAL via ublas wrote:
vector<int> v (10);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = i;
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.