Thread: adding matrix

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    5

    Exclamation adding matrix

    I need to add two matrixes together.
    I am confused on how to write the function.
    I have the function to enter the rows and colimns but I have no idea on how to add them together.
    Such as

    1 2 3
    4 5 6
    7 8 9


    12 11 12
    13 14 15
    16 17 18
    then add together

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Well, it's quite impossible to offer code help, as there isn't anything to work with, but is it a problem with understanding the idea of adding matrices together?

    Like to add together your two matrixes, you just look at each cell of the matrix, and add together the values. For example, let's use your matrixes as a and b, and let's figure out matrix c = a + b.

    The top left element (1,1) will be 13, because that's 1 + 12
    The top middle (1, 2) will be 13, because that's 2 + 11
    (1, 3) = 3 + 12
    (2, 1) = 4 + 13
    (2, 2) = 5 + 14
    (2, 3) = 6 + 15
    etc...

    Is that what you are asking?

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, 01:30 PM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 05:57 PM
  3. adding two matrix
    By vaibhav in forum C++ Programming
    Replies: 7
    Last Post: 11-15-2005, 03:09 AM
  4. What is a matrix's purpose in OpenGL
    By jimboob in forum Game Programming
    Replies: 5
    Last Post: 11-14-2004, 12:19 AM