Type: Posts; User: replax
Search took 0.01 seconds.
March 29th, 2010, 04:08 PM
This is the almost final program, thanks for your help!
@Lindley, thanks for the information on return values and copy constructors!
as for the...
March 29th, 2010, 02:56 PM
In which case would it get called?
March 29th, 2010, 02:32 PM
Ah ok I thought you ment to replace it. Anyway, I figured that it works like that:
float& Matrix::operator()(const int nRow, const int nCol) const
return m_pfMatrix[nRow * m_nColCount...
March 29th, 2010, 01:37 PM
I thought of that, but then I would not be able to modify the matrix using
Matrix(nRow, nCol) = X;
is there another way of doing this?
March 29th, 2010, 10:09 AM
Thanks for your information.
Initially, I had them as const Matrix&, however, as I am using the overloaded () operator inside the constructor and assignment operator, I am not allowed to use...
March 29th, 2010, 08:58 AM
thanks for the very constructive input!
as for now, I got it working as far as I can see it. Now my constructors are the same, I just fixed the allocation that was not initialized to 0 and added...
March 29th, 2010, 05:23 AM
no, I did not implent the copy constructor.
So when doing
return does copy the matrix and then returns the copy because the original matrix goes out of scope, right? and when...
March 29th, 2010, 03:08 AM
thank you for your answer!
the problem is, if I use my Matrix constructor to construct a matrix, it will call the destructor before returning the matrix value. thus crashing the programm.
March 28th, 2010, 06:38 PM
thanks, I got that part.
now I am a little further, still I am getting not total correct results
Matrix operator*(const Matrix &cObj1, const Matrix &cObj2)
float *pfaResMat = new...
March 28th, 2010, 02:48 PM
You were of course right with the size, I always tested with 2x2 matrices.
could you maybe explain the text in bold a little bit further? thanks
March 28th, 2010, 09:38 AM
the program would have to do:
n=a*y+b*z and m=c*y+d*z
i figured that it has to be somewhat like this:
for(int nRo = 0; nRow < resmatrix.m_nRowCount; nRow++)
for(int nCol = 0; nCol <...
March 28th, 2010, 09:33 AM
thanks for your quick response!
why do you think that the size is wrong? because it works well for me (doing matrix additions etc.).
i know how to multiply matrices, but heres the problem...
March 28th, 2010, 07:30 AM
im currently writing a class which stores matrices and performs arithmic operations with them.
the matrices are stored as follows:
float *pfaMatrix = new float[nColumnCount +...
Click Here to Expand Forum to Full Width