Loading graph_framework/math.hpp +3 −3 Original line number Diff line number Diff line Loading @@ -985,9 +985,9 @@ namespace graph { if (ldlm.get()) { if (rc.get() && rc->evaluate().is_even()) { if (ldlm->get_left()->is_constant() && ldlm->get_left()->evaluate().is_negative()) { return pow(ldlm->get_right()/ld->get_right(), if (ldlm->get_left()->is_constant()) { return pow(ldlm->get_left(), this->right) * pow(ldlm->get_right()/ld->get_right(), this->right); } } Loading graph_framework/timing.hpp +6 −6 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ namespace timeing { } else if (total_time_ns.count() < 3600000000000) { std::cout << total_time_ns.count()/60000000000.0 << " min" << std::endl; } else { std::cout << total_time_ns.count()/3600000000000 << " h" << std::endl; std::cout << total_time_ns.count()/3600000000000.0 << " h" << std::endl; } std::cout << std::endl; } Loading graph_tests/math_test.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -409,6 +409,14 @@ void test_pow() { graph::pow(var_c, var_b) * graph::pow(var_d, var_b)) && "Expected a^(d/2)*b^2*c^d."); auto factorconst = graph::pow(-0.5*var_a/var_b, 2.0); auto factorconst_cast = graph::multiply_cast(factorconst); assert(factorconst_cast.get() && "Expected a multiply node."); assert(factorconst_cast->get_left()->is_match(graph::constant<T> (static_cast<T> (0.25))) && "Expected 0.25 on the left."); assert(factorconst_cast->get_right()->is_match(graph::pow(var_a/var_b, 2.0)) && "Expected (a/b)^2 on the right."); } //------------------------------------------------------------------------------ Loading Loading
graph_framework/math.hpp +3 −3 Original line number Diff line number Diff line Loading @@ -985,9 +985,9 @@ namespace graph { if (ldlm.get()) { if (rc.get() && rc->evaluate().is_even()) { if (ldlm->get_left()->is_constant() && ldlm->get_left()->evaluate().is_negative()) { return pow(ldlm->get_right()/ld->get_right(), if (ldlm->get_left()->is_constant()) { return pow(ldlm->get_left(), this->right) * pow(ldlm->get_right()/ld->get_right(), this->right); } } Loading
graph_framework/timing.hpp +6 −6 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ namespace timeing { } else if (total_time_ns.count() < 3600000000000) { std::cout << total_time_ns.count()/60000000000.0 << " min" << std::endl; } else { std::cout << total_time_ns.count()/3600000000000 << " h" << std::endl; std::cout << total_time_ns.count()/3600000000000.0 << " h" << std::endl; } std::cout << std::endl; } Loading
graph_tests/math_test.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -409,6 +409,14 @@ void test_pow() { graph::pow(var_c, var_b) * graph::pow(var_d, var_b)) && "Expected a^(d/2)*b^2*c^d."); auto factorconst = graph::pow(-0.5*var_a/var_b, 2.0); auto factorconst_cast = graph::multiply_cast(factorconst); assert(factorconst_cast.get() && "Expected a multiply node."); assert(factorconst_cast->get_left()->is_match(graph::constant<T> (static_cast<T> (0.25))) && "Expected 0.25 on the left."); assert(factorconst_cast->get_right()->is_match(graph::pow(var_a/var_b, 2.0)) && "Expected (a/b)^2 on the right."); } //------------------------------------------------------------------------------ Loading