insert data in boost ublas matrix matlab style

380 Views Asked by At

I would like to insert data in a ublas::matrix but in one line the same as Matlab just like this (or something similar):

model = [  
    0.0685    0.6383    0.4558    0.7411   -0.7219    0.7081    0.7061  0.2887   -0.9521   -0.2553 
    0.4636    0.0159   -0.1010    0.2817    0.6638    0.1582    0.3925 -0.7954    0.6965   -0.7795
    0         0         0         0         0         0         0       0         0         0];
1

There are 1 best solutions below

0
On

If you take a look at the boost documentation, here is a list of the constructors of the matrix class http://www.boost.org/doc/libs/1_51_0/libs/numeric/ublas/doc/matrix.htm#18Members

As you can see from this documentation, it does not appear that there is a means of doing what you want at the present time, so I would suggest (unless you receive a better answer) that you populate your matrix using loops. Matlab and C++ are distinct languages so you cannot assume that you will be able to access functionality in identical manners.