473,471 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Initialize vector matrix using a function

1 New Member
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){
  2.  
  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.;
  7.  
  8.         return;
  9. }
Jul 12 '13 #1
0 1072

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

Similar topics

0
by: drife | last post by:
Hello, Has anyone a Python script for rotating an eigenvector matrix using the varimax (or quartimax or other) methods? Thanks in advance for your help. Daran
2
by: sci | last post by:
class A; void function(vector<A>* l) { .... } main(){ vector<A> aAList; function(&aAList);
6
by: Dennis | last post by:
In my program I have defined a global vector with //=======prototypes section ==================== float select(const int k, std::vector<float> &myArr, int iStart, int iEnd); ..... //====Global...
1
by: Mike | last post by:
In C, we can typedef pointer to functions, and therefore use function tables. But what's the advantage of using function table? Thanks, Mike
0
by: Anthony Liu | last post by:
I am talking about the 'take' method of numarray. See here for more info: http://stsdas.stsci.edu/numarray/Doc/node33.html If I initialize a matrix 'mymatrix' by zeros((3,3),...
8
by: Klaas Vantournhout | last post by:
Hi all, I'm in need of a matrix of function pointers, and to be honest. No 'nice' solution has been found yet on that big big internet. It is possible to declare a matrix of function pointers...
3
by: Holgerson | last post by:
Hi everybody, I wonder if someone knows how to implement an operator* into NRVec and/ or NRMat, respectively, that can perform these kind of operations: Matrix*Vector and Vector*Matrix. Thanks a...
0
by: inquisitive | last post by:
Is it possible to have a vector of generic function pointers? I am able to devise a generic function pointer, this way: template <typename elemType, elemType (*function)(std::string&)> struct...
3
by: raras | last post by:
could somebody help me to write the script of program to multiply 2D matrix using function and pointer? please ... thanx for helping me!
3
by: Chris Winton | last post by:
Hello my code below is returning the wrong value when the MatrixMult function is called in StateEstimate for the value M2. When the code is debugged, with a break point at void MatrixMult() and i...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.