矩阵运算源码最新版本
源代码在线查看: complexity.cpp
#include #include #include #include #include using namespace std; using namespace mtl::complexity_classes; namespace mpl = boost::mpl; struct wahr { void operator() () { cout }; struct falsch { void operator() () { cout }; void schreib(infinite) { cout void schreib(polynomial) { cout void schreib(quadratic) { cout void schreib(n_polylog_n) { cout void schreib(n_log_n) { cout void schreib(linear) { cout void schreib(linear_cached) { cout void schreib(polylog_n) { cout void schreib(log_n) { cout void schreib(constant) { cout void schreib(cached) { cout template void write_less(X, Y) { typedef mpl::less less_res; typename mpl::if_::type()(); } template void write_plus(X, Y) { schreib(typename mtl::complexity_classes::plus::type()); } template void write_mal(X, Y) { schreib(typename mtl::complexity_classes::times::type()); } int main (int argc, char** argv) { write_less(quadratic(), infinite()); write_less(quadratic(), linear()); write_plus(quadratic(), infinite()); write_plus(quadratic(), linear()); write_plus(linear(), quadratic()); write_plus(n_log_n(), linear()); write_mal(quadratic(), infinite()); write_mal(infinite(), quadratic()); write_mal(quadratic(), quadratic()); write_mal(linear(), quadratic()); write_mal(linear(), log_n()); write_mal(linear(), polylog_n()); write_mal(n_log_n(), log_n()); write_mal(n_log_n(), polylog_n()); write_mal(cached(), log_n()); write_mal(log_n(), log_n()); write_mal(cached(), constant()); return 0; }