Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么我不能以如下方式从二进制文件中读取 ublas 向量(而不是一次读取一个元素):
boost::numeric::ublas::vector<double> floatVector(10); myFile.read( (char *)&vector, 10 * sizeof(double));
有没有办法从数组中初始化 ublas 向量?
double d[10];
你可以使用这样的东西
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());