Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

arcticf0x

Matrix Multiplication C++

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. arcticf0x
    Best Response
    You've already chosen the best response.
    Medals 2

    There seems to be some logical error here, and i am not able to really understand the following part. Code: http://ideone.com/wgZ3J And the part followed by //mult there.

    • 2 years ago
  2. nczempin
    Best Response
    You've already chosen the best response.
    Medals 0

    the page you linked shows up empty for me; on Firefox

    • 2 years ago
  3. farmdawgnation
    Best Response
    You've already chosen the best response.
    Medals 0

    Ditto to the above comment.

    • 2 years ago
  4. arcticf0x
    Best Response
    You've already chosen the best response.
    Medals 2

    My bad, fixed it, http://ideone.com/wgZ3J

    • 2 years ago
  5. agdgdgdgwngo
    Best Response
    You've already chosen the best response.
    Medals 2

    http://ideone.com/mQNtH lets have a look at before the entire "mult" block...

    • 2 years ago
  6. agdgdgdgwngo
    Best Response
    You've already chosen the best response.
    Medals 2

    http://ideone.com/si08f there now it's better. Instead of the cin >> m >> n; I used cin >> m; and the n = m; same for the o and p. Let's uncomment that mult block. http://ideone.com/EYFhR everything seems fine now.

    • 2 years ago
  7. arcticf0x
    Best Response
    You've already chosen the best response.
    Medals 2

    Yes but that would just multiply sqare matrices. I want it for normal multiplication, and want to know exactly what happens (inside) with those three loops.

    • 2 years ago
  8. arcticf0x
    Best Response
    You've already chosen the best response.
    Medals 2

    But thanks for alteast caring about it @agdgdgdgwngo btw, in void print_matrix(int m[10][10], int s) what is int s for?

    • 2 years ago
  9. agdgdgdgwngo
    Best Response
    You've already chosen the best response.
    Medals 2

    Ahh I thought you only needed square matrices :-P the s in the print_matrix procedure specifies the size of the square matrix. I've now modified the print_matrix procedure so it works on row and column dimensions. http://ideone.com/ktBnc the first and second loops in main() just fill up the first and second matrices with input from cin the last loop does the dot product of two matrices

    • 2 years ago
  10. arcticf0x
    Best Response
    You've already chosen the best response.
    Medals 2

    Wow! Its on a roll now! Sorry to trouble you so much, one last thing, what is the role of m and o in print_matrix(mult, m, o); if its for size as before, then shouldnt it be m,p? And for "for(int k=0;k<n;k++)" am i correct in saying, that the previous loops assign the locations of rows and colums (m and p respectively) and this one multiplies the their values? If that is what you mean by dot product.

    • 2 years ago
  11. agdgdgdgwngo
    Best Response
    You've already chosen the best response.
    Medals 2

    Right; it should be print_matrix(mult, m, p); my bad :-P Right about the for loop as well: that particular one one is computing the matrix product.

    • 2 years ago
  12. arcticf0x
    Best Response
    You've already chosen the best response.
    Medals 2

    Thank you very much!

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.