Matrix Multiplication

This is a discussion on Matrix Multiplication within the C++ Programming forums, part of the General Programming Boards category; Hello, i would like to program a program that can do Matrix Multiplication. I'm a beginner in C++, i heard ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    56

    Unhappy Matrix Multiplication

    Hello, i would like to program a program that can do Matrix Multiplication.

    I'm a beginner in C++, i heard that we should use 2-dimentional Array....

    What other "thing" we need for programming Matrix Multiplication????

    Do we need to know "class"???
    I don't know "class" yet..

    Please help.

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    a matrix can be an array of floats

    float matrix[4][4];

    simple as that. it's a two dimensional array of floats. you don't NEED classes for anything but they are very good for structuring your code. Wait till you learn them to mess with it. For now, all you need is above
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    56

    Wink

    Thanks,

    Can someone give me an internet web site that show how to do Matrix Multiplication with c++, or the algorithm for that??

    Thanks

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    When you multiply two matrices, the first ones width must be the same as the second ones height. The resulting matrix will have the first ones height and the second ones width (as shown in the figure).
    Attached Images Attached Images  
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    244
    Matrix multiplication:

    the i,j location in the product (the answer) is the dot product of the ith row of the first matrix and the jth column of the second matrix.

    so the 1,1 spot of the product is the dot product of the first row and the first column. (in matrix notation, the first number is the row and the second is the column).

    If (5, 2, 3, 1) and (2, 3, 4, 1) are what you are finding the dot product of, it would be (5 * 2) + (2 * 3) + (3 * 4) + (1 * 1)

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