37# include <gtest/gtest.h>
53 size_t best = std::numeric_limits<size_t>::max();
54 for (
size_t k = i;
k < j; ++
k)
68 const size_t i,
const size_t j)
72 const size_t k =
split[i][j];
138 for (
int i = 1; i <= 6; ++i)
140 std::string name =
"A" + std::to_string(i);
141 EXPECT_NE(
r.parenthesization.find(name), std::string::npos)
142 <<
"Missing " << name <<
" in: " <<
r.parenthesization;
147 for (
char c :
r.parenthesization)
149 if (c ==
'(') ++depth;
150 else if (c ==
')') --depth;
169 const size_t n =
dims.size() - 1;
175 std::mt19937
rng(20260226);
178 const size_t n = 2 +
rng() % 6;
181 for (
size_t i = 0; i <= n; ++i)
182 dims.append(1 +
static_cast<size_t>(
rng() % 25));
193 const size_t M = std::numeric_limits<size_t>::max();
Matrix-chain multiplication optimization via interval DP.
Simple dynamic array with automatic resizing and functional operations.
void reserve(size_t cap)
Reserves cap cells into the array.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
Matrix_Chain_Result matrix_chain_order(const Array< size_t > &dims)
Compute the optimal matrix-chain multiplication order.
size_t matrix_chain_min_cost(const Array< size_t > &dims)
Compute only the minimum multiplication cost (value only).
std::vector< std::string > & split(const std::string &s, const char delim, std::vector< std::string > &elems)
Split a std::string by a single delimiter character.