By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Initialize vector matrix using a function

P: 1
I've many matrix like vector<vector<double> > A1, ..., Am, and I want to initialize them using a function like the following instead of do them repeatly. But it does not work. Who can please shed some light on this?
Expand|Select|Wrap|Line Numbers
  1. double_mtx(vector<vector<double> > &mtx,int row, int col){
  3.         mtx.resize(row);
  4.         for(int i=0;i<row;i++)mtx[row].resize(col);
  5.         for(int i=0;i<row;i++)
  6.                 for(int j=0;j<col;j++)mtx[i][j]=0.;
  8.         return;
  9. }
Jul 12 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.