|
Ublas : |
From: pkyoung (pkyoung_at_[hidden])
Date: 2007-03-21 02:34:56
i have trouble with reading ublas matrix from input stream.
after quite long googling, i came to read the previous posting in this
mailing list:
http://archives.free.net.ph/message/20060810.144620.1baee34f.en.html
After this posting, is there any progress with this??
-- in case you cannot read the above link. my problem in detail is as following: and the cause of problem is as stated in the link: > STL shipped with VC2005 does not support > extraction of numbers separated with anything but whitespace so the size of matrix enclosed by [ and , ( as in [3,3]) cannot be read. code: #include <fstream> #include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/io.hpp> namespace ub=boost::numeric::ublas; int main(int argc, char* argv[]) { ub::matrix<int> data; data.resize(3,3); for (int i=0 ; i<3 ; i++) { for (int j=0 ; j<3 ; j++) { data(i,j)=i*j; } } std::ofstream ofs("data.txt"); ofs << data << "\n"; ofs.close(); ub::matrix<int> out; std::ifstream ifs("data.txt"); ifs >> out; std::cout << out << "\n"; return 0; } g++ on linux, this gives [3,3]((0,0,0),(0,1,2),(0,2,4)) but with vc8.0 this gives [0,0]()