Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: "Expanding matrices"
Replies: 3   Last Post: Apr 9, 2013 6:41 AM

 Messages: [ Previous | Next ]
 Guest
"Expanding matrices"
Posted: Apr 8, 2013 12:53 PM

There may be some very simple function for this I'm unaware of but I'm trying to multiply out matrices as if they were brackets whilst retaining all the terms.

For example

Phase1=[A ;
B]
Phase2=[C , D ;
E, F]
Phase3=[ G;
H;
I]

I'm trying to multiply each of these out so the end result would be
Phases=[A , C, D, G;
A , C, D, H;
A , C, D, I;
A , E, F, G;
A , E, F, H;
A , E, F, I;
B , C, D, G;
B , C, D, H;
B , C, D, I;
B , E, F, G;
B , E, F, H;
B , E, F, I;]

However, there will be an unknown number of 'phases' (matrices) and these will be an unknown number of rows and columns.

Firstly I'm asking is there a simple function to combine two matrices together row by row as I'm sure I can work from there. If not does anyone have any recommendations about how to go about this as my initial thought was it needs an unknown number of 'for' loops. Also some matrices may be getting on for 10^6 in length so any hints on speeding up the code would be appreciated.

If I haven't explained this clearly please let me know!

Thanks,

Jon

Date Subject Author
4/8/13 Guest
4/8/13 test
4/8/13 Bruno Luong
4/9/13 Jono