Skip to content

Calculates the best order in which to multiply a string of matrices

Notifications You must be signed in to change notification settings

louiswins/matrix-multiplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

This program will calculate the best order in which to multiply a string of
matrices, given their sizes. It implements the dynamic-programming example from
CLRS.

To specify your own matrices, you need to simply modify the p variable defined
at the top of the source. In the example, there are four matrices, the first of
size 40x20, the second of 20x50, etc. (The length of p[] will be one more than
the number of matrices).

If you want to include this in your own program, the most important function is
fill_matrices(). You can then parse the s matrix to figure out the correct order
of multiplication. (For an example of how to parse it, see print_expr().)

About

Calculates the best order in which to multiply a string of matrices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages