Matrix Multiplication

This is a discussion on Matrix Multiplication within the C++ Programming forums, part of the General Programming Boards category; For those that don't know me, I am not good at programming due to a severe lack of knowledge. Ok, ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    10

    Thumbs down Matrix Multiplication

    For those that don't know me, I am not good at programming due to a severe lack of knowledge.

    Ok, I know how to make an array, and I think I know how to add 2 arrays(3x3):

    for(int row=0 , row<3 , row++)
    {for(int col=0 , col <3 , col++)
    {sum[row][col]=A[row][col]+B[row][col];
    }}

    I think that is right. But the problem is, that I need to multiply the 2 arrays, not add them, and I can't figure it out, any help would be nice.

  2. #2
    Registered User Zeeshan's Avatar
    Join Date
    Oct 2001
    Location
    Munich, Germany
    Posts
    224
    Hey, the solution in pseudo-code is

    // multiplies 'a' of the order (m x p) with 'b' of the order (p x n) into 'c'

    MATMUL(int **a,int **b,int **c,int m,int p,int n)

    for i = 1 to m
    for j = 1 to n
    c[i][j] = 0
    for k = 1 to p
    c[i][j] = c[i][j] + a[i][k] * b[k][j]
    }
    }
    }

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    10
    what is matmul? << that was astupid question.
    Last edited by Warped1; 11-06-2001 at 12:00 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 02:30 PM
  2. *operator overloading: scalar matrix multiplication
    By gemini_shooter in forum C++ Programming
    Replies: 4
    Last Post: 06-08-2009, 02:14 PM
  3. Matrix Multiplication ( Accessing data from a file ) HELP
    By six_degreez in forum C Programming
    Replies: 2
    Last Post: 07-24-2008, 06:21 PM
  4. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 05:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21