1,105,254 Community Members

matrix-chain multiplication

Member Avatar
tulip6
Newbie Poster
1 post since Oct 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hi every one...........
i'm new in this forum and need ur help please....

i want to write a programme using c++ code,
programme that find the optimal parenthesization of a matrix-chain product, then perform the optimal matrix -chain multiply 4 a sequence of matrices, but the user should enter the number of the matrices and its dimensions.........

plz need ur help guys


thnx .........

Member Avatar
Salem
Posting Sage
7,177 posts since Dec 2005
Reputation Points: 5,138 [?]
Q&As Helped to Solve: 970 [?]
Skill Endorsements: 41 [?]
Team Colleague
 
0
 
Member Avatar
iamthwee
Posting Sage
7,036 posts since Aug 2005
Reputation Points: 1,307 [?]
Q&As Helped to Solve: 592 [?]
Skill Endorsements: 74 [?]
Featured
 
0
 

>programme that find the optimal parenthesization of a matrix-chain product

Try reading this:-
http://en.wikipedia.org/wiki/Matrix_chain_multiplication

>then perform the optimal matrix -chain multiply 4 a sequence of matrices

Multiplication would go something like this:-

public static void mmult (int rows, int cols, 
                          int[][] m1, int[][] m2, int[][] m3) {
    for (int i=0; i<rows; i++) {
        for (int j=0; j<cols; j++) {
        int val = 0;
        for (int k=0; k<cols; k++) {
            val += m1[i][k] * m2[k][j];
        }
        m3[i][j] = val;
        }
    }
    }

>but the user should enter the number of the matrices and its dimensions.........

I assume you know what cin is and how to initialise a 2D array?

Member Avatar
kh_mukid
Newbie Poster
1 post since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-3
 

Given an array of 10 elements, sort the data from index 2 to 6 using insertion sort algorithm.
Write the c/c++ code for Matrix Chain Multiplication Algorithm for at least 5 matrixes.

please solve this in c code.

Member Avatar
TECHNICAL GIRL
Newbie Poster
1 post since Feb 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-3
 

could anyone be kind enough to provide me with a c++ program on matrix chain multiplication?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article