15 template<jit::
float_scalar T,
bool SAFE_MATH=false>
21 template<jit::
float_scalar T,
bool SAFE_MATH=false>
35 template<std::
floating_po
int T,
bool SAFE_MATH=false>
86 return this->shared_from_this();
102 if (registers.find(
this) == registers.end()) {
103 auto arg = this->arg->
compile(stream, registers,
107 stream <<
" const bool ";
108 stream << registers[
this] <<
" = isinf("
109 << registers[
arg.get()] <<
")";
113 return this->shared_from_this();
120 std::cout <<
"isinf\\left(";
122 std::cout <<
"\\right)";
134 if (registers.find(
this) == registers.end()) {
136 registers[
this] = name;
137 stream <<
" " << name
138 <<
" [label = \"!\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
141 stream <<
" " << name <<
" -- " << registers[
arg.get()] <<
";" << std::endl;
144 return this->shared_from_this();
156 template<std::
floating_po
int T,
bool SAFE_MATH=false>
158 auto temp = std::make_shared<isinf_node<T, SAFE_MATH>> (arg)->reduce();
160 for (
size_t i = temp->get_hash();
161 i < std::numeric_limits<size_t>::max();
i++) {
170#if defined(__clang__) || defined(__GNUC__)
171 __builtin_unreachable();
173 assert(
false &&
"Should never reach.");
178 template<std::
floating_po
int T,
bool SAFE_MATH=false>
190 template<std::
floating_po
int T,
bool SAFE_MATH=false>
192 return std::dynamic_pointer_cast<isinf_node<T, SAFE_MATH>> (x);
204 template<std::
floating_po
int T,
bool SAFE_MATH=false>
255 return this->shared_from_this();
271 if (registers.find(
this) == registers.end()) {
272 auto arg = this->arg->
compile(stream, registers,
276 stream <<
" const bool ";
277 stream << registers[
this] <<
" = isnan("
278 << registers[
arg.get()] <<
")";
282 return this->shared_from_this();
289 std::cout <<
"isnan\\left(";
291 std::cout <<
"\\right)";
303 if (registers.find(
this) == registers.end()) {
305 registers[
this] = name;
306 stream <<
" " << name
307 <<
" [label = \"!\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
310 stream <<
" " << name <<
" -- " << registers[
arg.get()] <<
";" << std::endl;
313 return this->shared_from_this();
325 template<std::
floating_po
int T,
bool SAFE_MATH=false>
327 auto temp = std::make_shared<isnan_node<T, SAFE_MATH>> (arg)->reduce();
329 for (
size_t i = temp->get_hash();
330 i < std::numeric_limits<size_t>::max();
i++) {
339#if defined(__clang__) || defined(__GNUC__)
340 __builtin_unreachable();
342 assert(
false &&
"Should never reach.");
347 template<std::
floating_po
int T,
bool SAFE_MATH=false>
359 template<std::
floating_po
int T,
bool SAFE_MATH=false>
361 return std::dynamic_pointer_cast<isnan_node<T, SAFE_MATH>> (x);
375 template<jit::
float_scalar T,
bool SAFE_MATH=false>
427 return equalc->get_left() != equalc->get_right();
433 return nequalc->get_left() == nequalc->get_right();
440 return ltc->get_left() >= ltc->get_right();
446 return lec->get_left() > lec->get_right();
452 return gtc->get_left() <= gtc->get_right();
458 return gec->get_left() < gec->get_right();
468 return this->shared_from_this();
484 if (registers.find(
this) == registers.end()) {
485 auto arg = this->arg->
compile(stream, registers,
489 stream <<
" const bool "
490 << registers[
this] <<
" = !";
494 stream << registers[
arg.get()];
501 return this->shared_from_this();
508 bool arg_brackets =
add_cast(this->arg).get() ||
512 std::cout <<
"\\left(";
516 std::cout <<
"\\right)";
529 if (registers.find(
this) == registers.end()) {
531 registers[
this] = name;
532 stream <<
" " << name
533 <<
" [label = \"!\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
536 stream <<
" " << name <<
" -- " << registers[
arg.get()] <<
";" << std::endl;
539 return this->shared_from_this();
551 template<jit::
float_scalar T,
bool SAFE_MATH=false>
553 auto temp = std::make_shared<not_node<T, SAFE_MATH>> (arg)->reduce();
555 for (
size_t i = temp->get_hash();
556 i < std::numeric_limits<size_t>::max();
i++) {
565#if defined(__clang__) || defined(__GNUC__)
566 __builtin_unreachable();
568 assert(
false &&
"Should never reach.");
583 template<jit::
float_scalar T,
bool SAFE_MATH=false>
589 template<jit::
float_scalar T,
bool SAFE_MATH=false>
601 template<jit::
float_scalar T,
bool SAFE_MATH=false>
603 return std::dynamic_pointer_cast<not_node<T, SAFE_MATH>> (x);
617 template<jit::
float_scalar T,
bool SAFE_MATH=false>
657 return l_result == r_result;
670 if (l.get() && r.get()) {
674 return this->shared_from_this();
690 if (registers.find(
this) == registers.end()) {
691 auto l = this->
left->compile(stream, registers,
693 auto r = this->
right->compile(stream, registers,
697 stream <<
" const bool ";
698 stream << registers[
this] <<
" = "
699 << registers[l.get()] <<
"=="
700 << registers[r.get()];
704 return this->shared_from_this();
714 if (
this == x.get()) {
721 if ((this->
left->is_match(x_cast->get_left()) &&
722 this->right->is_match(x_cast->get_right())) ||
723 (this->right->is_match(x_cast->get_left()) &&
724 this->left->is_match(x_cast->get_right()))) {
741 std::cout <<
"\\left(";
743 this->
left->to_latex();
745 std::cout <<
"\\right)";
749 std::cout <<
"\\left(";
751 this->
right->to_latex();
753 std::cout <<
"\\right)";
766 if (registers.find(
this) == registers.end()) {
768 registers[
this] = name;
769 stream <<
" " << name
770 <<
" [label = \"==\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
772 auto l = this->
left->to_vizgraph(stream, registers);
773 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
774 auto r = this->
right->to_vizgraph(stream, registers);
775 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
778 return this->shared_from_this();
791 template<jit::
float_scalar T,
bool SAFE_MATH=false>
794 auto temp = std::make_shared<equal_node<T, SAFE_MATH>> (l, r)->reduce();
796 for (
size_t i = temp->get_hash();
797 i < std::numeric_limits<size_t>::max();
i++) {
806#if defined(__clang__) || defined(__GNUC__)
807 __builtin_unreachable();
809 assert(
false &&
"Should never reach.");
825 template<jit::
float_scalar T,
bool SAFE_MATH=false>
844 template<jit::
float_scalar T, jit::
float_scalar L,
bool SAFE_MATH=false>
863 template<jit::
float_scalar T, jit::
float_scalar R,
bool SAFE_MATH=false>
870 template<jit::
float_scalar T,
bool SAFE_MATH=false>
882 template<jit::
float_scalar T,
bool SAFE_MATH=false>
884 return std::dynamic_pointer_cast<equal_node<T, SAFE_MATH>> (x);
898 template<jit::
float_scalar T,
bool SAFE_MATH=false>
938 return l_result != r_result;
951 if (l.get() && r.get()) {
955 return this->shared_from_this();
971 if (registers.find(
this) == registers.end()) {
972 auto l = this->
left->compile(stream, registers,
974 auto r = this->
right->compile(stream, registers,
978 stream <<
" const bool ";
979 stream << registers[
this] <<
" = "
980 << registers[l.get()] <<
"!="
981 << registers[r.get()];
985 return this->shared_from_this();
995 if (
this == x.get()) {
1002 if ((this->
left->is_match(x_cast->get_left()) &&
1003 this->right->is_match(x_cast->get_right())) ||
1004 (this->right->is_match(x_cast->get_left()) &&
1005 this->left->is_match(x_cast->get_right()))) {
1022 std::cout <<
"\\left(";
1024 this->
left->to_latex();
1026 std::cout <<
"\\right)";
1028 std::cout <<
"\\ne";
1030 std::cout <<
"\\left(";
1032 this->
right->to_latex();
1034 std::cout <<
"\\right)";
1047 if (registers.find(
this) == registers.end()) {
1049 registers[
this] = name;
1050 stream <<
" " << name
1051 <<
" [label = \"!=\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
1053 auto l = this->
left->to_vizgraph(stream, registers);
1054 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
1055 auto r = this->
right->to_vizgraph(stream, registers);
1056 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
1059 return this->shared_from_this();
1072 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1075 auto temp = std::make_shared<not_equal_node<T, SAFE_MATH>> (l, r)->reduce();
1077 for (
size_t i = temp->get_hash();
1078 i < std::numeric_limits<size_t>::max();
i++) {
1087#if defined(__clang__) || defined(__GNUC__)
1088 __builtin_unreachable();
1090 assert(
false &&
"Should never reach.");
1106 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1125 template<jit::
float_scalar T, jit::
float_scalar L,
bool SAFE_MATH=false>
1144 template<jit::
float_scalar T, jit::
float_scalar R,
bool SAFE_MATH=false>
1151 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1163 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1165 return std::dynamic_pointer_cast<not_equal_node<T, SAFE_MATH>> (x);
1179 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1219 return l_result > r_result;
1232 if (l.get() && r.get()) {
1236 return this->shared_from_this();
1252 if (registers.find(
this) == registers.end()) {
1253 auto l = this->
left->compile(stream, registers,
1255 auto r = this->
right->compile(stream, registers,
1259 stream <<
" const bool ";
1260 stream << registers[
this] <<
" = "
1261 << registers[l.get()] <<
">"
1262 << registers[r.get()];
1266 return this->shared_from_this();
1278 std::cout <<
"\\left(";
1280 this->
left->to_latex();
1282 std::cout <<
"\\right)";
1286 std::cout <<
"\\left(";
1288 this->
right->to_latex();
1290 std::cout <<
"\\right)";
1303 if (registers.find(
this) == registers.end()) {
1305 registers[
this] = name;
1306 stream <<
" " << name
1307 <<
" [label = \">\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
1309 auto l = this->
left->to_vizgraph(stream, registers);
1310 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
1311 auto r = this->
right->to_vizgraph(stream, registers);
1312 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
1315 return this->shared_from_this();
1328 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1331 auto temp = std::make_shared<greater_than_node<T, SAFE_MATH>> (l, r)->reduce();
1333 for (
size_t i = temp->get_hash();
1334 i < std::numeric_limits<size_t>::max();
i++) {
1343#if defined(__clang__) || defined(__GNUC__)
1344 __builtin_unreachable();
1346 assert(
false &&
"Should never reach.");
1362 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1381 template<std::
floating_po
int T, std::
floating_po
int L,
bool SAFE_MATH=false>
1400 template<std::
floating_po
int T, std::
floating_po
int R,
bool SAFE_MATH=false>
1407 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1419 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1421 return std::dynamic_pointer_cast<greater_than_node<T, SAFE_MATH>> (x);
1435 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1475 return l_result < r_result;
1488 if (l.get() && r.get()) {
1492 return this->shared_from_this();
1508 if (registers.find(
this) == registers.end()) {
1509 auto l = this->
left->compile(stream, registers,
1511 auto r = this->
right->compile(stream, registers,
1515 stream <<
" const bool ";
1516 stream << registers[
this] <<
" = "
1517 << registers[l.get()] <<
"<"
1518 << registers[r.get()];
1522 return this->shared_from_this();
1534 std::cout <<
"\\left(";
1536 this->
left->to_latex();
1538 std::cout <<
"\\right)";
1542 std::cout <<
"\\left(";
1544 this->
right->to_latex();
1546 std::cout <<
"\\right)";
1559 if (registers.find(
this) == registers.end()) {
1561 registers[
this] = name;
1562 stream <<
" " << name
1563 <<
" [label = \"<\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
1565 auto l = this->
left->to_vizgraph(stream, registers);
1566 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
1567 auto r = this->
right->to_vizgraph(stream, registers);
1568 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
1571 return this->shared_from_this();
1584 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1587 auto temp = std::make_shared<less_than_node<T, SAFE_MATH>> (l, r)->reduce();
1589 for (
size_t i = temp->get_hash();
1590 i < std::numeric_limits<size_t>::max();
i++) {
1599#if defined(__clang__) || defined(__GNUC__)
1600 __builtin_unreachable();
1602 assert(
false &&
"Should never reach.");
1618 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1637 template<std::
floating_po
int T, std::
floating_po
int L,
bool SAFE_MATH=false>
1656 template<std::
floating_po
int T, std::
floating_po
int R,
bool SAFE_MATH=false>
1663 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1675 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1677 return std::dynamic_pointer_cast<less_than_node<T, SAFE_MATH>> (x);
1691 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1731 return l_result >= r_result;
1744 if (l.get() && r.get()) {
1748 return this->shared_from_this();
1764 if (registers.find(
this) == registers.end()) {
1765 auto l = this->
left->compile(stream, registers,
1767 auto r = this->
right->compile(stream, registers,
1771 stream <<
" const bool ";
1772 stream << registers[
this] <<
" = "
1773 << registers[l.get()] <<
">="
1774 << registers[r.get()];
1778 return this->shared_from_this();
1790 std::cout <<
"\\left(";
1792 this->
left->to_latex();
1794 std::cout <<
"\\right)";
1796 std::cout <<
"\\ge";
1798 std::cout <<
"\\left(";
1800 this->
right->to_latex();
1802 std::cout <<
"\\right)";
1815 if (registers.find(
this) == registers.end()) {
1817 registers[
this] = name;
1818 stream <<
" " << name
1819 <<
" [label = \">=\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
1821 auto l = this->
left->to_vizgraph(stream, registers);
1822 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
1823 auto r = this->
right->to_vizgraph(stream, registers);
1824 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
1827 return this->shared_from_this();
1840 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1843 auto temp = std::make_shared<greater_than_equal_node<T, SAFE_MATH>> (l, r)->reduce();
1845 for (
size_t i = temp->get_hash();
1846 i < std::numeric_limits<size_t>::max();
i++) {
1855#if defined(__clang__) || defined(__GNUC__)
1856 __builtin_unreachable();
1858 assert(
false &&
"Should never reach.");
1874 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1893 template<std::
floating_po
int T, std::
floating_po
int L,
bool SAFE_MATH=false>
1912 template<std::
floating_po
int T, std::
floating_po
int R,
bool SAFE_MATH=false>
1919 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1931 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1933 return std::dynamic_pointer_cast<greater_than_equal_node<T, SAFE_MATH>> (x);
1947 template<std::
floating_po
int T,
bool SAFE_MATH=false>
1987 return l_result <= r_result;
2000 if (l.get() && r.get()) {
2004 return this->shared_from_this();
2020 if (registers.find(
this) == registers.end()) {
2021 auto l = this->
left->compile(stream, registers,
2023 auto r = this->
right->compile(stream, registers,
2027 stream <<
" const bool ";
2028 stream << registers[
this] <<
" = "
2029 << registers[l.get()] <<
"<="
2030 << registers[r.get()];
2034 return this->shared_from_this();
2046 std::cout <<
"\\left(";
2048 this->
left->to_latex();
2050 std::cout <<
"\\right)";
2052 std::cout <<
"\\le";
2054 std::cout <<
"\\left(";
2056 this->
right->to_latex();
2058 std::cout <<
"\\right)";
2071 if (registers.find(
this) == registers.end()) {
2073 registers[
this] = name;
2074 stream <<
" " << name
2075 <<
" [label = \"<=\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
2077 auto l = this->
left->to_vizgraph(stream, registers);
2078 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
2079 auto r = this->
right->to_vizgraph(stream, registers);
2080 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
2083 return this->shared_from_this();
2096 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2099 auto temp = std::make_shared<less_than_equal_node<T, SAFE_MATH>> (l, r)->reduce();
2101 for (
size_t i = temp->get_hash();
2102 i < std::numeric_limits<size_t>::max();
i++) {
2111#if defined(__clang__) || defined(__GNUC__)
2112 __builtin_unreachable();
2114 assert(
false &&
"Should never reach.");
2130 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2149 template<std::
floating_po
int T, std::
floating_po
int L,
bool SAFE_MATH=false>
2168 template<std::
floating_po
int T, std::
floating_po
int R,
bool SAFE_MATH=false>
2175 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2187 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2189 return std::dynamic_pointer_cast<less_than_equal_node<T, SAFE_MATH>> (x);
2203 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2230 and_node::to_string(l.get(), r.get())) {}
2242 return l_result && r_result;
2255 if (l.get() && r.get()) {
2259 return this->shared_from_this();
2275 if (registers.find(
this) == registers.end()) {
2276 auto l = this->
left->compile(stream, registers,
2278 auto r = this->
right->compile(stream, registers,
2282 stream <<
" const bool ";
2283 stream << registers[
this] <<
" = "
2284 << registers[l.get()] <<
"&&"
2285 << registers[r.get()];
2289 return this->shared_from_this();
2299 if (
this == x.get()) {
2306 if ((this->
left->is_match(x_cast->get_left()) &&
2307 this->right->is_match(x_cast->get_right())) ||
2308 (this->right->is_match(x_cast->get_left()) &&
2309 this->left->is_match(x_cast->get_right()))) {
2326 std::cout <<
"\\left(";
2328 this->
left->to_latex();
2330 std::cout <<
"\\right)";
2332 std::cout <<
"\\land";
2334 std::cout <<
"\\left(";
2336 this->
right->to_latex();
2338 std::cout <<
"\\right)";
2351 if (registers.find(
this) == registers.end()) {
2353 registers[
this] = name;
2354 stream <<
" " << name
2355 <<
" [label = \"&&\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
2357 auto l = this->
left->to_vizgraph(stream, registers);
2358 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
2359 auto r = this->
right->to_vizgraph(stream, registers);
2360 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
2363 return this->shared_from_this();
2376 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2379 auto temp = std::make_shared<and_node<T, SAFE_MATH>> (l, r)->reduce();
2381 for (
size_t i = temp->get_hash();
2382 i < std::numeric_limits<size_t>::max();
i++) {
2391#if defined(__clang__) || defined(__GNUC__)
2392 __builtin_unreachable();
2394 assert(
false &&
"Should never reach.");
2410 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2428 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2446 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2453 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2465 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2467 return std::dynamic_pointer_cast<and_node<T, SAFE_MATH>> (x);
2481 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2508 or_node::to_string(l.get(), r.get())) {}
2520 return l_result || r_result;
2533 if (l.get() && r.get()) {
2537 return this->shared_from_this();
2553 if (registers.find(
this) == registers.end()) {
2554 auto l = this->
left->compile(stream, registers,
2556 auto r = this->
right->compile(stream, registers,
2560 stream <<
" const bool ";
2561 stream << registers[
this] <<
" = "
2562 << registers[l.get()] <<
"||"
2563 << registers[r.get()];
2567 return this->shared_from_this();
2577 if (
this == x.get()) {
2584 if ((this->
left->is_match(x_cast->get_left()) &&
2585 this->right->is_match(x_cast->get_right())) ||
2586 (this->right->is_match(x_cast->get_left()) &&
2587 this->left->is_match(x_cast->get_right()))) {
2604 std::cout <<
"\\left(";
2606 this->
left->to_latex();
2608 std::cout <<
"\\right)";
2610 std::cout <<
"\\lor";
2612 std::cout <<
"\\left(";
2614 this->
right->to_latex();
2616 std::cout <<
"\\right)";
2629 if (registers.find(
this) == registers.end()) {
2631 registers[
this] = name;
2632 stream <<
" " << name
2633 <<
" [label = \"||\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
2635 auto l = this->
left->to_vizgraph(stream, registers);
2636 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
2637 auto r = this->
right->to_vizgraph(stream, registers);
2638 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
2641 return this->shared_from_this();
2654 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2657 auto temp = std::make_shared<or_node<T, SAFE_MATH>> (l, r)->reduce();
2659 for (
size_t i = temp->get_hash();
2660 i < std::numeric_limits<size_t>::max();
i++) {
2669#if defined(__clang__) || defined(__GNUC__)
2670 __builtin_unreachable();
2672 assert(
false &&
"Should never reach.");
2688 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2706 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2724 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2731 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2743 template<std::
floating_po
int T,
bool SAFE_MATH=false>
2745 return std::dynamic_pointer_cast<or_node<T, SAFE_MATH>> (x);
2759 template<jit::
float_scalar T,
bool SAFE_MATH=false>
2806 return c_result.
if_(t_result, f_result);
2820 if (c.get() && t.get() && f.get()) {
2825 if (this->
middle->is_match(this->right)) {
2832 return if_(n->get_arg(), this->right, this->middle);
2835 return this->shared_from_this();
2852 const size_t hash =
reinterpret_cast<size_t> (x.get());
2853 if (this->
df_cache.find(
hash) == this->df_cache.end()) {
2856 this->right->df(x));
2874 if (registers.find(
this) == registers.end()) {
2875 auto c = this->
left->compile(stream, registers,
2878 auto t = this->
middle->compile(stream, registers,
2880 auto f = this->
right->compile(stream, registers,
2882 stream <<
" const ";
2884 stream <<
" " << registers[
this] <<
" = "
2885 << registers[c.get()] <<
" ? "
2886 << registers[t.get()] <<
" : "
2887 << registers[f.get()];
2891 return this->shared_from_this();
2898 std::cout <<
"if\\left(";
2899 this->
left->to_latex();
2901 this->
middle->to_latex();
2903 this->
right->to_latex();
2904 std::cout <<
"\\right)";
2915 this->
middle->remove_pseudo(),
2916 this->right->remove_pseudo());
2918 return this->shared_from_this();
2930 if (registers.find(
this) == registers.end()) {
2932 registers[
this] = name;
2933 stream <<
" " << name
2934 <<
" [label = \"if\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
2936 auto c = this->
left->to_vizgraph(stream, registers);
2937 stream <<
" " << name <<
" -- " << registers[c.get()] <<
";" << std::endl;
2938 auto t = this->
middle->to_vizgraph(stream, registers);
2939 stream <<
" " << name <<
" -- " << registers[t.get()] <<
";" << std::endl;
2940 auto f = this->
right->to_vizgraph(stream, registers);
2941 stream <<
" " << name <<
" -- " << registers[f.get()] <<
";" << std::endl;
2944 return this->shared_from_this();
2962 template<jit::
float_scalar T,
bool SAFE_MATH=false>
2966 auto temp = std::make_shared<if_node<T, SAFE_MATH>> (c, t, f)->reduce();
2968 for (
size_t i = temp->get_hash();
2969 i < std::numeric_limits<size_t>::max();
i++) {
2978#if defined(__clang__) || defined(__GNUC__)
2979 __builtin_unreachable();
2981 assert(
false &&
"Should never reach.");
2986 template<jit::
float_scalar T,
bool SAFE_MATH=false>
2998 template<jit::
float_scalar T,
bool SAFE_MATH=false>
3000 return std::dynamic_pointer_cast<if_node<T, SAFE_MATH>> (x);
3014 template<std::
floating_po
int T,
bool SAFE_MATH=false>
3067 if (lc.get() && rc.get()) {
3073 if (pl1.get() && (rc.get() || pl1->is_arg_match(this->right))) {
3075 }
else if (pr1.get() && (lc.get() || pr1->is_arg_match(this->left))) {
3081 if (pl2.get() && (rc.get() || pl2->is_arg_match(this->right))) {
3083 pl2->get_num_columns(),
3086 }
else if (pr2.get() && (lc.get() || pr2->is_arg_match(this->left))) {
3088 pr2->get_num_columns(),
3094 if (pr2.get() && pr2->is_row_match(this->left)) {
3096 result.
min_row(pr2->evaluate());
3098 pr2->get_num_columns(),
3101 }
else if (pr2.get() && pr2->is_col_match(this->left)) {
3103 result.
min_col(pr2->evaluate());
3105 pr2->get_num_columns(),
3108 }
else if (pl2.get() && pl2->is_row_match(this->right)) {
3110 result.
min_row(pr1->evaluate());
3112 pl2->get_num_columns(),
3115 }
else if (pl2.get() && pl2->is_col_match(this->right)) {
3117 result.
min_col(pr1->evaluate());
3119 pl2->get_num_columns(),
3124 return this->shared_from_this();
3141 const size_t hash =
reinterpret_cast<size_t> (x.get());
3142 if (this->
df_cache.find(
hash) == this->df_cache.end()) {
3144 this->right->df(x));
3162 if (registers.find(
this) == registers.end()) {
3163 auto l = this->
left->compile(stream, registers,
3165 auto r = this->
left->compile(stream, registers,
3169 stream <<
" const ";
3171 stream <<
" " << registers[
this] <<
" = min("
3172 << registers[l.get()] <<
", "
3173 << registers[r.get()] <<
")";
3177 return this->shared_from_this();
3187 if (
this == x.get()) {
3194 return (this->
left->is_match(x_cast->get_left()) &&
3195 this->right->is_match(x_cast->get_right())) ||
3196 (this->
right->is_match(x_cast->get_left()) &&
3197 this->left->is_match(x_cast->get_right()));
3207 std::cout <<
"min\\left(";
3208 this->
left->to_latex();
3210 this->
right->to_latex();
3211 std::cout <<
"\\right)";
3222 this->right->remove_pseudo());
3224 return this->shared_from_this();
3236 if (registers.find(
this) == registers.end()) {
3238 registers[
this] = name;
3239 stream <<
" " << name
3240 <<
" [label = \"min\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
3242 auto l = this->
left->to_vizgraph(stream, registers);
3243 stream <<
" " << name <<
" -- " << registers[l.get()] <<
";" << std::endl;
3244 auto r = this->
right->to_vizgraph(stream, registers);
3245 stream <<
" " << name <<
" -- " << registers[r.get()] <<
";" << std::endl;
3248 return this->shared_from_this();
3265 template<std::
floating_po
int T,
bool SAFE_MATH=false>
3268 auto temp = std::make_shared<min_node<T, SAFE_MATH>> (l, r)->reduce();
3270 for (
size_t i = temp->get_hash();
3271 i < std::numeric_limits<size_t>::max();
i++) {
3280#if defined(__clang__) || defined(__GNUC__)
3281 __builtin_unreachable();
3283 assert(
false &&
"Should never reach.");
3298 template<std::
floating_po
int T, jit::
float_scalar L,
bool SAFE_MATH=false>
3315 template<std::
floating_po
int T, jit::
float_scalar R,
bool SAFE_MATH=false>
3322 template<std::
floating_po
int T,
bool SAFE_MATH=false>
3334 template<jit::
float_scalar T,
bool SAFE_MATH=false>
3336 return std::dynamic_pointer_cast<min_node<T, SAFE_MATH>> (x);
Class representing a generic buffer.
Definition backend.hpp:29
void min_row(const buffer< T > &x)
Min row operation.
Definition backend.hpp:517
buffer< T > if_(const buffer< T > &t, const buffer< T > &f)
Apply condition.
Definition backend.hpp:892
void min_col(const buffer< T > &x)
Min col operation.
Definition backend.hpp:561
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce and node.
Definition logical.hpp:2250
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:2271
and_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct an and node.
Definition logical.hpp:2226
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:2320
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:2349
virtual backend::buffer< T > evaluate()
Evaluate the results of less than equal.
Definition logical.hpp:2239
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition logical.hpp:2298
Class representing a branch node.
Definition node.hpp:1336
branch_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r, const std::string s)
Definition node.hpp:1352
shared_leaf< T, SAFE_MATH > right
Definition node.hpp:1341
shared_leaf< T, SAFE_MATH > left
Definition node.hpp:1339
equal_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct an equal node.
Definition logical.hpp:640
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce an equal node.
Definition logical.hpp:665
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:686
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition logical.hpp:713
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:764
virtual backend::buffer< T > evaluate()
Evaluate the results of equal.
Definition logical.hpp:654
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:735
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:1813
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce greater than equal node.
Definition logical.hpp:1739
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:1784
virtual backend::buffer< T > evaluate()
Evaluate the results of greater than equal.
Definition logical.hpp:1728
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:1760
greater_than_equal_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct a greater than equal node.
Definition logical.hpp:1714
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce greater than node.
Definition logical.hpp:1227
virtual backend::buffer< T > evaluate()
Evaluate the results of greater than.
Definition logical.hpp:1216
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:1301
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:1272
greater_than_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct a greater than node.
Definition logical.hpp:1202
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:1248
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:2928
if_node(shared_leaf< T, SAFE_MATH > c, shared_leaf< T, SAFE_MATH > t, shared_leaf< T, SAFE_MATH > f)
Construct an equal node.
Definition logical.hpp:2787
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce an if node.
Definition logical.hpp:2814
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition logical.hpp:2912
virtual backend::buffer< T > evaluate()
Evaluate the results of if.
Definition logical.hpp:2802
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:2870
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:2897
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition logical.hpp:2847
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:119
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:98
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce an isinf node.
Definition logical.hpp:78
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:132
isinf_node(shared_leaf< T, SAFE_MATH > arg)
Construct an isinf node.
Definition logical.hpp:55
virtual backend::buffer< T > evaluate()
Evaluate the results of isinf.
Definition logical.hpp:67
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:288
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce an isnan node.
Definition logical.hpp:247
virtual backend::buffer< T > evaluate()
Evaluate the results of isnan.
Definition logical.hpp:236
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:267
isnan_node(shared_leaf< T, SAFE_MATH > arg)
Construct an isnan node.
Definition logical.hpp:224
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:301
Class representing a node leaf.
Definition node.hpp:370
virtual bool is_match(std::shared_ptr< leaf_node< T, SAFE_MATH > > x)
Definition node.hpp:482
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)=0
Compile the node.
virtual void to_latex() const
Convert the node to latex.
Definition node.hpp:529
virtual void endline(std::ostringstream &stream, const jit::register_usage &usage, const char end=';') const
Definition node.hpp:652
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)=0
Convert the node to vizgraph.
static caches_t caches
A per thread instance of the cache structure.
Definition node.hpp:682
virtual bool has_pseudo() const
Definition node.hpp:632
const size_t hash
Definition node.hpp:373
std::unordered_map< size_t, std::shared_ptr< leaf_node< T, SAFE_MATH > > > df_cache
Definition node.hpp:377
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:2016
virtual backend::buffer< T > evaluate()
Evaluate the results of less than equal.
Definition logical.hpp:1984
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce less than equal node.
Definition logical.hpp:1995
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:2069
less_than_equal_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct a less than equal node.
Definition logical.hpp:1970
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:2040
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce less than node.
Definition logical.hpp:1483
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:1504
virtual backend::buffer< T > evaluate()
Evaluate the results of less than.
Definition logical.hpp:1472
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:1557
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:1528
less_than_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct a less than node.
Definition logical.hpp:1458
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:3158
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce a min node.
Definition logical.hpp:3062
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:3234
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition logical.hpp:3186
min_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct an equal node.
Definition logical.hpp:3038
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:3206
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition logical.hpp:3136
virtual backend::buffer< T > evaluate()
Evaluate the results of if.
Definition logical.hpp:3051
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition logical.hpp:3219
no_derivative(const std::string s)
Definition node.hpp:1723
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:967
virtual backend::buffer< T > evaluate()
Evaluate the results of not equal.
Definition logical.hpp:935
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:1045
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition logical.hpp:994
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce an not equal node.
Definition logical.hpp:946
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:1016
not_equal_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct an not equal node.
Definition logical.hpp:921
not_node(shared_leaf< T, SAFE_MATH > arg)
Construct an not node.
Definition logical.hpp:394
virtual backend::buffer< T > evaluate()
Evaluate the results of not.
Definition logical.hpp:406
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:507
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:480
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:527
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce a not node.
Definition logical.hpp:416
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce or node.
Definition logical.hpp:2528
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition logical.hpp:2576
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, const jit::register_map &thread_mem, const jit::register_usage &usage)
Compile the node.
Definition logical.hpp:2549
or_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct a or node.
Definition logical.hpp:2504
virtual backend::buffer< T > evaluate()
Evaluate the results of less than equal.
Definition logical.hpp:2517
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition logical.hpp:2627
virtual void to_latex() const
Convert the node to latex.
Definition logical.hpp:2598
Class representing a straight node.
Definition node.hpp:1218
shared_leaf< T, SAFE_MATH > arg
Definition node.hpp:1221
triple_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > m, shared_leaf< T, SAFE_MATH > r, const std::string s)
Definition node.hpp:1480
shared_leaf< T, SAFE_MATH > middle
Definition node.hpp:1469
Complex scalar concept.
Definition register.hpp:25
subroutine assert(test, message)
Assert check.
Definition f_binding_test.f90:38
buffer< T > min(buffer< T > &a, buffer< T > &b)
Min operation.
Definition backend.hpp:1052
Name space for graph nodes.
Definition arithmetic.hpp:13
shared_piecewise_2D< T, SAFE_MATH > piecewise_2D_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a piecewise 2D node.
Definition piecewise.hpp:1508
shared_leaf< T, SAFE_MATH > less_than(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build less than node from two leaves.
Definition logical.hpp:1585
shared_leaf< T, SAFE_MATH > operator!(shared_leaf< T, SAFE_MATH > arg)
Build not node from two leaves.
Definition logical.hpp:584
shared_not< T, SAFE_MATH > not_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a not node.
Definition logical.hpp:602
shared_leaf< T, SAFE_MATH > and_(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build and node from two leaves.
Definition logical.hpp:2377
std::shared_ptr< less_than_equal_node< T, SAFE_MATH > > shared_less_than_equal
Convenience type alias for shared less than equal nodes.
Definition logical.hpp:2176
shared_not_equal< T, SAFE_MATH > not_equal_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a equal node.
Definition logical.hpp:1164
shared_leaf< T, SAFE_MATH > operator>(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build greater than node from two leaves.
Definition logical.hpp:1363
shared_leaf< T, SAFE_MATH > isnan(shared_leaf< T, SAFE_MATH > arg)
Build isnan node from the argument leaves.
Definition logical.hpp:326
shared_subtract< T, SAFE_MATH > subtract_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a subtract node.
Definition arithmetic.hpp:1710
constexpr shared_leaf< T, SAFE_MATH > zero()
Forward declare for zero.
Definition node.hpp:1153
shared_equal< T, SAFE_MATH > equal_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a equal node.
Definition logical.hpp:883
shared_leaf< T, SAFE_MATH > not_(shared_leaf< T, SAFE_MATH > arg)
Build not node from the argument leaves.
Definition logical.hpp:552
std::shared_ptr< min_node< T, SAFE_MATH > > shared_min
Convenience type alias for shared min nodes.
Definition logical.hpp:3323
std::shared_ptr< isnan_node< T, SAFE_MATH > > shared_isnan
Convenience type alias for shared isnan nodes.
Definition logical.hpp:348
shared_greater_than< T, SAFE_MATH > greater_than_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a greater than node.
Definition logical.hpp:1420
shared_leaf< T, SAFE_MATH > not_equal(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build note equal node from two leaves.
Definition logical.hpp:1073
shared_and< T, SAFE_MATH > and_cast(shared_leaf< T, SAFE_MATH > x)
Cast to an and node.
Definition logical.hpp:2466
shared_add< T, SAFE_MATH > add_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a add node.
Definition arithmetic.hpp:855
shared_leaf< T, SAFE_MATH > greater_than(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build greater than node from two leaves.
Definition logical.hpp:1329
std::shared_ptr< less_than_node< T, SAFE_MATH > > shared_less_than
Convenience type alias for shared less than nodes.
Definition logical.hpp:1664
shared_leaf< T, SAFE_MATH > less_than_equal(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build less than equal node from two leaves.
Definition logical.hpp:2097
shared_leaf< T, SAFE_MATH > operator<(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build less than node from two leaves.
Definition logical.hpp:1619
shared_piecewise_1D< T, SAFE_MATH > piecewise_1D_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a piecewise 1D node.
Definition piecewise.hpp:849
shared_leaf< T, SAFE_MATH > or_(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build or node from two leaves.
Definition logical.hpp:2655
std::shared_ptr< equal_node< T, SAFE_MATH > > shared_equal
Convenience type alias for shared equal nodes.
Definition logical.hpp:871
shared_leaf< T, SAFE_MATH > operator!=(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build not equal node from two leaves.
Definition logical.hpp:1107
constexpr shared_leaf< T, SAFE_MATH > one()
Forward declare for one.
Definition node.hpp:1166
shared_leaf< T, SAFE_MATH > operator>=(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build greater than equal node from two leaves.
Definition logical.hpp:1875
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:690
std::shared_ptr< if_node< T, SAFE_MATH > > shared_if
Convenience type alias for shared add nodes.
Definition logical.hpp:2987
shared_isnan< T, SAFE_MATH > isnan_cast(shared_leaf< T, SAFE_MATH > x)
Cast to an isnan node.
Definition logical.hpp:360
shared_constant< T, SAFE_MATH > constant_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a constant node.
Definition node.hpp:1201
shared_less_than_equal< T, SAFE_MATH > less_than_equal_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a less than equal node.
Definition logical.hpp:2188
std::shared_ptr< isinf_node< T, SAFE_MATH > > shared_isinf
Convenience type alias for shared isinf nodes.
Definition logical.hpp:179
std::shared_ptr< greater_than_equal_node< T, SAFE_MATH > > shared_greater_than_equal
Convenience type alias for shared greater than equal nodes.
Definition logical.hpp:1920
constexpr T i
Convenience type for imaginary constant.
Definition node.hpp:1185
shared_min< T, SAFE_MATH > min_cast(shared_leaf< T, SAFE_MATH > x)
Cast to an min node.
Definition logical.hpp:3335
shared_leaf< T, SAFE_MATH > operator||(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build or node from two leaves.
Definition logical.hpp:2689
shared_isinf< T, SAFE_MATH > isinf_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a isinf node.
Definition logical.hpp:191
shared_leaf< T, SAFE_MATH > if_(shared_leaf< T, SAFE_MATH > c, shared_leaf< T, SAFE_MATH > t, shared_leaf< T, SAFE_MATH > f)
Build an if node from a condition and two leaves.
Definition logical.hpp:2963
shared_leaf< T, SAFE_MATH > constant(const backend::buffer< T > &d)
Construct a constant.
Definition node.hpp:1110
std::shared_ptr< not_equal_node< T, SAFE_MATH > > shared_not_equal
Convenience type alias for shared not equal nodes.
Definition logical.hpp:1152
std::shared_ptr< not_node< T, SAFE_MATH > > shared_not
Convenience type alias for shared not nodes.
Definition logical.hpp:590
shared_leaf< T, SAFE_MATH > min(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build a max node from a condition and two leaves.
Definition logical.hpp:3266
shared_leaf< T, SAFE_MATH > equal(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build equal node from two leaves.
Definition logical.hpp:792
shared_leaf< T, SAFE_MATH > operator==(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build equal node from two leaves.
Definition logical.hpp:826
std::shared_ptr< or_node< T, SAFE_MATH > > shared_or
Convenience type alias for shared or nodes.
Definition logical.hpp:2732
std::shared_ptr< greater_than_node< T, SAFE_MATH > > shared_greater_than
Convenience type alias for shared greater than nodes.
Definition logical.hpp:1408
shared_less_than< T, SAFE_MATH > less_than_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a less than node.
Definition logical.hpp:1676
shared_leaf< T, SAFE_MATH > isinf(shared_leaf< T, SAFE_MATH > arg)
Build not node from the argument leaves.
Definition logical.hpp:157
constexpr shared_leaf< T, SAFE_MATH > true_constant()
Convenience type for true constant.
Definition logical.hpp:16
constexpr shared_leaf< T, SAFE_MATH > false_constant()
Convenience type for false constant.
Definition logical.hpp:22
shared_leaf< T, SAFE_MATH > operator<=(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build less than equal node from two leaves.
Definition logical.hpp:2131
shared_leaf< T, SAFE_MATH > operator&&(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build and node from two leaves.
Definition logical.hpp:2411
shared_if< T, SAFE_MATH > if_cast(shared_leaf< T, SAFE_MATH > x)
Cast to an if node.
Definition logical.hpp:2999
shared_or< T, SAFE_MATH > or_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a or node.
Definition logical.hpp:2744
shared_greater_than_equal< T, SAFE_MATH > greater_than_equal_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a greater than equal node.
Definition logical.hpp:1932
shared_leaf< T, SAFE_MATH > greater_than_equal(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build greater than equal node from two leaves.
Definition logical.hpp:1841
std::shared_ptr< and_node< T, SAFE_MATH > > shared_and
Convenience type alias for shared and nodes.
Definition logical.hpp:2454
std::string format_to_string(const T value)
Convert a value to a string while avoiding locale.
Definition register.hpp:213
std::unordered_map< void *, size_t > register_usage
Type alias for counting register usage.
Definition register.hpp:261
void add_type(std::basic_ostream< char > &stream)
Write out the node base type to a general stream.
Definition register.hpp:165
std::unordered_map< void *, std::string > register_map
Type alias for mapping node pointers to register names.
Definition register.hpp:259
std::string to_string(const char prefix, const NODE *pointer)
Convert a graph::leaf_node pointer to a string.
Definition register.hpp:247
Base nodes of graph computation framework.
void piecewise_1D()
Tests for 1D piecewise nodes.
Definition piecewise_test.cpp:82
void piecewise_2D()
Tests for 2D piecewise nodes.
Definition piecewise_test.cpp:321