CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: replax

Search: Search took 0.03 seconds.

  1. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    This is the almost final program, thanks for your help!

    http://rapidshare.com/files/369676516/matrix.zip

    @Lindley, thanks for the information on return values and copy constructors!
    as for the...
  2. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    In which case would it get called?
  3. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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...
  4. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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?
  5. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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...
  6. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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...
  7. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    no, I did not implent the copy constructor.
    So when doing

    return cResMatrix;
    return does copy the matrix and then returns the copy because the original matrix goes out of scope, right? and when...
  8. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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.

    the...
  9. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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...
  10. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    thanks again.
    You were of course right with the size, I always tested with 2x2 matrices.

    as for


    could you maybe explain the text in bold a little bit further? thanks

    yours sincerely,
  11. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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 <...
  12. Replies
    26
    Views
    20,201

    Re: matrix multiplication

    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...
  13. Replies
    26
    Views
    20,201

    matrix multiplication

    hello,

    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 +...
Results 1 to 13 of 13





Click Here to Expand Forum to Full Width

Featured