0down votefavoritehttp://stackoverflow.com/questions/20591096/file-read-and-fill-matrix-in-boost#
I have following set of code
<sstream>#include <cstdlib>#include <iterator>#include <queue>#include <algorithm>#include <string>#include <cassert>#include <cmath>#include <iomanip>#include <new>#include <algorithm>#include <functional>#include <vector> using namespace std; using std::vector;</vector></functional></algorithm></new></iomanip></cmath></cassert></string></algorithm></queue></iterator></cstdlib></sstream>
<boost numeric="" ublas="" io.hpp="">#include <boost numeric="" ublas="" operation.hpp=""> using namespace boost::numeric::ublas;</boost></boost>
boost::numeric::ublas::matrix<double> A_MATRIX(10,10); int main(){</double>
int i,j,temp1,temp2; double temp3; ifstream ptrReadCtvtxt; ptrReadCtvtxt.open("ctv.txt"); for(i=0;i<10;i++){ for(j = 0; j < 10; j++){ if(j==0){ ptrReadCtvtxt >> temp1; if(temp1>maxCtv) maxCtv=temp1; } if(j==1) ptrReadCtvtxt >> temp2; if(j==2) ptrReadCtvtxt >>temp3; } A_MATRIX (temp1-1)(temp2-1)=temp3; } ptrReadCtvtxt.close();
return 0; }
When I build, I receive this error for line A_MATRIX (temp1-1)(temp2-1)=temp3;
error: no match for call to ‘(boost::numeric::ublas::matrix, boost::numeric::ublas::unbounded_array > >) (int)’
I appreciate any help. Thanks a lot
PS: I am sure, temp1, and temp2 values are within bounds of matrix.
Log in to post a comment.
0down votefavoritehttp://stackoverflow.com/questions/20591096/file-read-and-fill-matrix-in-boost#
I have following set of code
include <ctime>#include <iostream>#include <fstream>#include</fstream></iostream></ctime>
<sstream>#include <cstdlib>#include <iterator>#include <queue>#include
<algorithm>#include <string>#include <cassert>#include <cmath>#include
<iomanip>#include <new>#include <algorithm>#include
<functional>#include <vector>
using namespace std;
using std::vector;</vector></functional></algorithm></new></iomanip></cmath></cassert></string></algorithm></queue></iterator></cstdlib></sstream>
include <boost numeric="" ublas="" matrix.hpp="">#include</boost>
<boost numeric="" ublas="" io.hpp="">#include
<boost numeric="" ublas="" operation.hpp="">
using namespace boost::numeric::ublas;</boost></boost>
boost::numeric::ublas::matrix<double> A_MATRIX(10,10);
int main(){</double>
return 0;
}
When I build, I receive this error for line A_MATRIX
(temp1-1)(temp2-1)=temp3;
error: no match for call to ‘(boost::numeric::ublas::matrix,
boost::numeric::ublas::unbounded_array > >) (int)’
I appreciate any help. Thanks a lot
PS: I am sure, temp1, and temp2 values are within bounds of matrix.