You are here:

- Home
- Computing/Technology
- C/C++
- C++
- matrix multiplication coding

Advertisement

Hello, Hope you're doing well. I am trying to write a loop program which multiplies inverse of a matrix M1 by matrix M2 twenty times iterating their variable i from 1 to 20. Each matrix M1 and M2 is a 4*4 matrix whose each element is a function of r =i*constant

the elements of matrices are in the form of some Bessel’s functions and quite long. I decided to store each element under a new name to avoid complications.

I also tried using a for loop similar to

(int i = 1; i <= 20; i++) {

cout << i << endl;

}

int product = 0;

for (int i = 0; i <= 20; i++) {

cout << i << endl;

product function of the matrices goes here;

}

Would this be a reasonable approach? I tried using Matlab with a simple matrix to be multiplied 20 times and it failed. Do you have any suggestion for writing a program that can multiply two matrices 20 times with iterating their elements each time?

Hi Shirin

Write a program that multiplies a n/n matrix with another n/n matrix and put the thing in a loop as you have said which will iterate 20 times.

You can have a look at this link if you have any problem regarding multiplication of matrix.

http://www.scodz.com/ViewProgram.php?uid=2&link=6

Try it once and if you fail do let me know so that I can give you more hints about doing the same.

regards

Joydeep Bhattacharya

http://www.scodz.com

- How to Use Loops in Ruby--While, Until, Each and Times Loops
- 2008 World Figure Skating Championships Review by Sonia Bianchetti Garbato - "Lights and Shadows at the Scandinavium" by Sonia Bianchetti Garbato
- Literal Loop
- Wedding Programs - Essential Elements of a Wedding Program
- wall time - What is wall time

TSR, Socket and Very Complex Mathematical Problem

Worked on many OOP projects with design patterns**Organizations**

http://www.scodz.com**Publications**

http://www.scodz.com**Education/Credentials**

Master of Computer Applications**Awards and Honors**

Being a proud owner of a website of programming called http://www.scodz.com**Past/Present Clients**

http://www.funforu.com
http://www.dhoondho.com
http://analysingc.50webs.com