guven - 2013-12-15

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

<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;

include <boost numeric="" ublas="" matrix.hpp="">#include

<boost numeric="" ublas="" io.hpp="">#include
<boost numeric="" ublas="" operation.hpp="">
using namespace boost::numeric::ublas;

boost::numeric::ublas::matrix<double> A_MATRIX(10,10);
int main(){

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.