c++ - Read ublas vectors from binary file or init it with array[] -


why cannot read ublas vectors binary file in way (instead of reading 1 element @ time):

boost::numeric::ublas::vector<double> floatvector(10); myfile.read( (char *)&vector, 10 * sizeof(double)); 

is there way initialize ublas vector array?

double d[10]; 

you can use this

   double array[] = {1., 2., 3.};    boost::numeric::ublas::vector<double> v(sizeof(array) / sizeof(*array));    std::copy(array, array + sizeof(array) / sizeof(*array), v.data().begin()); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -