|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Matrix-chain multiplication optimization via interval DP. More...
#include <limits>#include <string>#include <cstddef>#include <ah-errors.H>#include <tpl_array.H>Go to the source code of this file.
Classes | |
| struct | Aleph::Matrix_Chain_Result |
| Result of matrix-chain multiplication optimization. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::matrix_chain_detail |
Functions | |
| size_t | Aleph::matrix_chain_detail::checked_add (const size_t a, const size_t b, const char *ctx) |
| size_t | Aleph::matrix_chain_detail::checked_mul (const size_t a, const size_t b, const char *ctx) |
| size_t | Aleph::matrix_chain_detail::scalar_cost (const size_t di, const size_t dk, const size_t dj) |
| void | Aleph::matrix_chain_detail::build_parens (const Array< Array< size_t > > &s, size_t i, size_t j, std::string &out) |
| Matrix_Chain_Result | Aleph::matrix_chain_order (const Array< size_t > &dims) |
| Compute the optimal matrix-chain multiplication order. | |
| size_t | Aleph::matrix_chain_min_cost (const Array< size_t > &dims) |
| Compute only the minimum multiplication cost (value only). | |
Matrix-chain multiplication optimization via interval DP.
The matrix-chain multiplication problem is a classic optimization problem that seeks the most efficient way to multiply a given sequence of matrices. Since matrix multiplication is associative, the order in which we parenthesize the product can significantly affect the number of scalar multiplications required.
This header provides an interval dynamic programming solution to find:
| Algorithm | Time | Space |
|---|---|---|
| matrix_chain_order | O(n^3) | O(n^2) |
| matrix_chain_min_cost | O(n^3) | O(n^2) |
Definition in file Matrix_Chain.H.