25 template<jit::
float_scalar T,
bool SAFE_MATH=false>
69 if (
ac->is(0) ||
ac->is(1)) {
86 ap2->get_num_columns(),
87 ap2->get_left(),
ap2->get_x_scale(),
ap2->get_x_offset(),
88 ap2->get_right(),
ap2->get_y_scale(),
ap2->get_y_offset());
96 am->get_left()->is_constant() ||
98 am->get_right()->is_constant()) {
100 return sqrt(
am->get_left()) *
103 if (
am->get_left()->is_constant() &&
104 !
am->get_left()->evaluate().is_negative()) {
105 return sqrt(
am->get_left()) *
116 if (
alm.get() &&
alm->get_left()->is_constant()) {
124 ad->get_left()->is_constant() ||
126 ad->get_right()->is_constant()) {
127 return sqrt(
ad->get_left()) /
148 const size_t hash =
reinterpret_cast<size_t> (x.get());
170 if (registers.find(
this) == registers.end()) {
178 jit::add_type<T> (stream);
179 stream <<
" " << registers[
this] <<
" = sqrt("
180 << registers[
a.get()] <<
")";
194 if (
this == x.get()) {
200 return this->
arg->is_match(
x_cast->get_arg());
210 std::cout <<
"\\sqrt{";
211 this->
arg->to_latex();
249 return sqrt(this->
arg->remove_pseudo());
263 if (registers.find(
this) == registers.end()) {
265 registers[
this] =
name;
266 stream <<
" " <<
name
267 <<
" [label = \"sqrt\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
269 auto a = this->
arg->to_vizgraph(stream, registers);
270 stream <<
" " <<
name <<
" -- " << registers[
a.get()] <<
";" << std::endl;
286 template<jit::
float_scalar T,
bool SAFE_MATH=false>
288 auto temp = std::make_shared<sqrt_node<T, SAFE_MATH>> (x)->reduce();
290 for (
size_t i =
temp->get_hash();
300#if defined(__clang__) || defined(__GNUC__)
303 assert(
false &&
"Should never reach.");
308 template<jit::
float_scalar T,
bool SAFE_MATH=false>
320 template<jit::
float_scalar T,
bool SAFE_MATH=false>
322 return std::dynamic_pointer_cast<sqrt_node<T, SAFE_MATH>> (x);
336 template<jit::
float_scalar T,
bool SAFE_MATH=false>
392 ap2->get_num_columns(),
393 ap2->get_left(),
ap2->get_x_scale(),
ap2->get_x_offset(),
394 ap2->get_right(),
ap2->get_y_scale(),
ap2->get_y_offset());
419 const size_t hash =
reinterpret_cast<size_t> (x.get());
440 if (registers.find(
this) == registers.end()) {
448 jit::add_type<T> (stream);
449 stream <<
" " << registers[
this] <<
" = ";
454 stream << registers[
a.get()];
458 stream <<
" < 709.8 ? ";
460 stream <<
"exp(" << registers[
a.get()] <<
")";
464 jit::add_type<T> (stream);
486 if (
this == x.get()) {
492 return this->
arg->is_match(
x_cast->get_arg());
502 std::cout <<
"e^{\\left(";
503 this->
arg->to_latex();
504 std::cout <<
"\\right)}";
514 return exp(this->
arg->remove_pseudo());
528 if (registers.find(
this) == registers.end()) {
530 registers[
this] =
name;
531 stream <<
" " <<
name
532 <<
" [label = \"exp\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
534 auto a = this->
arg->to_vizgraph(stream, registers);
535 stream <<
" " <<
name <<
" -- " << registers[
a.get()] <<
";" << std::endl;
551 template<jit::
float_scalar T,
bool SAFE_MATH=false>
553 auto temp = std::make_shared<exp_node<T, SAFE_MATH>> (x)->reduce();
555 for (
size_t i =
temp->get_hash();
565#if defined(__clang__) || defined(__GNUC__)
568 assert(
false &&
"Should never reach.");
573 template<jit::
float_scalar T,
bool SAFE_MATH=false>
585 template<jit::
float_scalar T,
bool SAFE_MATH=false>
587 return std::dynamic_pointer_cast<exp_node<T, SAFE_MATH>> (x);
601 template<jit::
float_scalar T,
bool SAFE_MATH=false>
657 ap2->get_num_columns(),
658 ap2->get_left(),
ap2->get_x_scale(),
ap2->get_x_offset(),
659 ap2->get_right(),
ap2->get_y_scale(),
ap2->get_y_offset());
684 const size_t hash =
reinterpret_cast<size_t> (x.get());
705 if (registers.find(
this) == registers.end()) {
713 jit::add_type<T> (stream);
714 stream <<
" " << registers[
this] <<
" = log("
715 << registers[
a.get()] <<
")";
729 if (
this == x.get()) {
735 return this->
arg->is_match(
x_cast->get_arg());
745 std::cout <<
"\\ln{\\left(";
746 this->
arg->to_latex();
747 std::cout <<
"\\right)}";
757 return log(this->
arg->remove_pseudo());
771 if (registers.find(
this) == registers.end()) {
773 registers[
this] =
name;
774 stream <<
" " <<
name
775 <<
" [label = \"log\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
777 auto a = this->
arg->to_vizgraph(stream, registers);
778 stream <<
" " <<
name <<
" -- " << registers[
a.get()] <<
";" << std::endl;
794 template<jit::
float_scalar T,
bool SAFE_MATH=false>
796 auto temp = std::make_shared<log_node<T, SAFE_MATH>> (x)->reduce();
807#if defined(__clang__) || defined(__GNUC__)
810 assert(
false &&
"Should never reach.");
815 template<jit::
float_scalar T,
bool SAFE_MATH=false>
827 template<jit::
float_scalar T,
bool SAFE_MATH=false>
829 return std::dynamic_pointer_cast<log_node<T, SAFE_MATH>> (x);
843 template<jit::
float_scalar T,
bool SAFE_MATH=false>
893 if (
rc.get() &&
rc->is(0)) {
895 }
else if (
rc.get() &&
rc->is(1)) {
897 }
else if (
rc.get() &&
rc->is(0.5)) {
899 }
else if (
rc.get() &&
rc->is(2)){
902 return sq->get_arg();
906 if (
lc.get() &&
rc.get()) {
912 if (
pl1.get() && (
rc.get() ||
pl1->is_arg_match(
this->right))) {
914 pl1->get_scale(),
pl1->get_offset());
915 }
else if (
pr1.get() && (
lc.get() ||
pr1->is_arg_match(
this->left))) {
917 pr1->get_scale(),
pr1->get_offset());
922 if (
pl2.get() && (
rc.get() ||
pl2->is_arg_match(
this->right))) {
924 pl2->get_num_columns(),
925 pl2->get_left(),
pl2->get_x_scale(),
pl2->get_x_offset(),
926 pl2->get_right(),
pl2->get_y_scale(),
pl2->get_y_offset());
927 }
else if (
pr2.get() && (
lc.get() ||
pr2->is_arg_match(
this->left))) {
929 pr2->get_num_columns(),
930 pr2->get_left(),
pr2->get_x_scale(),
pr2->get_x_offset(),
931 pr2->get_right(),
pr2->get_y_scale(),
pr2->get_y_offset());
935 if (
pr2.get() &&
pr2->is_row_match(
this->left)) {
939 pr2->get_num_columns(),
940 pr2->get_left(),
pr2->get_x_scale(),
pr2->get_x_offset(),
941 pr2->get_right(),
pr2->get_y_scale(),
pr2->get_y_offset());
942 }
else if (
pr2.get() &&
pr2->is_col_match(
this->left)) {
946 pr2->get_num_columns(),
947 pr2->get_left(),
pr2->get_x_scale(),
pr2->get_x_offset(),
948 pr2->get_right(),
pr2->get_y_scale(),
pr2->get_y_offset());
949 }
else if (
pl2.get() &&
pl2->is_row_match(
this->right)) {
953 pl2->get_num_columns(),
954 pl2->get_left(),
pl2->get_x_scale(),
pl2->get_x_offset(),
955 pl2->get_right(),
pl2->get_y_scale(),
pl2->get_y_offset());
956 }
else if (
pl2.get() &&
pl2->is_col_match(
this->right)) {
960 pl2->get_num_columns(),
961 pl2->get_left(),
pl2->get_x_scale(),
pl2->get_x_offset(),
962 pl2->get_right(),
pl2->get_y_scale(),
pl2->get_y_offset());
967 if (
lp.get() &&
rc.get() &&
rc->is_integer()) {
968 return pow(
lp->get_left(),
lp->get_right()*
this->right);
974 if (
lm.get() &&
rc.get()) {
975 if (
lm->get_left()->is_constant() ||
976 lm->get_right()->is_constant() ||
981 return pow(
lm->get_left(),
this->right) *
989 if (
lmlm->get_left()->is_constant() ||
990 lmlm->get_right()->is_constant() ||
1004 if (
ld.get() &&
rc.get()) {
1010 rc->evaluate().is_even()) {
1011 if (
ldlm->get_left()->is_constant()) {
1017 if (
ldlm->get_left()->is_constant() ||
1018 ldlm->get_right()->is_constant() ||
1030 if (
ldlmlm->get_left()->is_constant() ||
1031 ldlmlm->get_right()->is_constant() ||
1045 if (
ldlmrm->get_left()->is_constant() ||
1046 ldlmrm->get_right()->is_constant() ||
1060 if (
ld->get_left()->is_constant() ||
1061 ld->get_right()->is_constant() ||
1066 return pow(
ld->get_left(),
this->right) /
1073 if (
ldrm->get_left()->is_constant() ||
1074 ldrm->get_right()->is_constant() ||
1079 return pow(
ld->get_left(),
this->right) /
1086 if (
ldrmlm->get_left()->is_constant() ||
1087 ldrmlm->get_right()->is_constant() ||
1092 return pow(
ld->get_left(),
this->right) /
1101 if (
ldrmrm->get_left()->is_constant() ||
1102 ldrmrm->get_right()->is_constant() ||
1107 return pow(
ld->get_left(),
this->right) /
1117 return pow(
ld->get_left()->get_power_base(),
1118 this->right*(
ld->get_left()->get_power_exponent() -
1119 ld->get_right()->get_power_exponent()));
1126 ldrmlm->get_right()->get_power_base())) {
1132 ldrmlm->get_left()->get_power_base())) {
1138 ldrmlm->get_right()->get_power_base()) ||
1140 ldrmlm->get_left()->get_power_base())) {
1141 return pow(
ld->get_left()/
ldrm->get_right(),
1153 return pow(
lsq->get_arg(),
1159 if (
temp.get() &&
rc.get() &&
rc->is_integer()) {
1180 const size_t hash =
reinterpret_cast<size_t> (x.get());
1203 if (registers.find(
this) == registers.end()) {
1210 if (!
temp.get() || !
temp->is_integer()) {
1215 stream <<
" const ";
1216 jit::add_type<T> (stream);
1217 stream <<
" " << registers[
this] <<
" = ";
1218 if (
temp.get() &&
temp->is_integer()) {
1219 stream << registers[
l.get()];
1220 const size_t end =
static_cast<size_t> (std::real(this->
right->evaluate().at(0)));
1221 for (
size_t i = 1;
i < end;
i++) {
1222 stream <<
"*" << registers[
l.get()];
1226 << registers[
l.get()] <<
", "
1227 << registers[
r.get()] <<
")";
1242 if (
this == x.get()) {
1248 return this->
left->is_match(
x_cast->get_left()) &&
1263 std::cout <<
"\\left(";
1265 this->
left->to_latex();
1267 std::cout <<
"\\right)";
1270 this->
right->to_latex();
1283 if (registers.find(
this) == registers.end()) {
1285 registers[
this] =
name;
1286 stream <<
" " <<
name
1287 <<
" [label = \"pow\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
1289 auto l = this->
left->to_vizgraph(stream, registers);
1290 stream <<
" " <<
name <<
" -- " << registers[
l.get()] <<
";" << std::endl;
1291 auto r = this->
right->to_vizgraph(stream, registers);
1292 stream <<
" " <<
name <<
" -- " << registers[
r.get()] <<
";" << std::endl;
1304 return this->
left->is_all_variables() &&
1305 (this->
right->is_all_variables() ||
1343 return pow(this->
left->remove_pseudo(),
1344 this->right->remove_pseudo());
1359 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1362 auto temp = std::make_shared<pow_node<T, SAFE_MATH>> (
l,
r)->reduce();
1364 for (
size_t i =
temp->get_hash();
1374#if defined(__clang__) || defined(__GNUC__)
1377 assert(
false &&
"Should never reach.");
1391 template<jit::
float_scalar T, jit::
float_scalar L,
bool SAFE_MATH=false>
1407 template<jit::
float_scalar T, jit::
float_scalar R,
bool SAFE_MATH=false>
1414 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1423 template<jit::
float_scalar T,
bool SAFE_MATH=false>
1425 return std::dynamic_pointer_cast<pow_node<T, SAFE_MATH>> (x);
1439 template<jit::complex_scalar T,
bool SAFE_MATH=false>
1495 ap2->get_num_columns(),
1496 ap2->get_left(),
ap2->get_x_scale(),
ap2->get_x_offset(),
1497 ap2->get_right(),
ap2->get_y_scale(),
ap2->get_y_offset());
1516 const size_t hash =
reinterpret_cast<size_t> (x.get());
1519 *
exp(this->
arg*this->
arg)*this->arg->df(x);
1538 if (registers.find(
this) == registers.end()) {
1545 stream <<
" const ";
1546 jit::add_type<T> (stream);
1547 stream <<
" " << registers[
this] <<
" = special::erfi("
1548 << registers[
a.get()] <<
")";
1562 if (
this == x.get()) {
1568 return this->
arg->is_match(
x_cast->get_arg());
1578 std::cout <<
"erfi\\left(";
1579 this->
arg->to_latex();
1580 std::cout <<
"\\right)";
1590 return erfi(this->
arg->remove_pseudo());
1604 if (registers.find(
this) == registers.end()) {
1606 registers[
this] =
name;
1607 stream <<
" " <<
name
1608 <<
" [label = \"erfi\", shape = oval, style = filled, fillcolor = blue, fontcolor = white];" << std::endl;
1610 auto a = this->
arg->to_vizgraph(stream, registers);
1611 stream <<
" " <<
name <<
" -- " << registers[
a.get()] <<
";" << std::endl;
1627 template<jit::complex_scalar T,
bool SAFE_MATH=false>
1629 auto temp = std::make_shared<erfi_node<T, SAFE_MATH>> (x)->reduce();
1631 for (
size_t i =
temp->get_hash();
1641#if defined(__clang__) || defined(__GNUC__)
1644 assert(
false &&
"Should never reach.");
1649 template<jit::complex_scalar T,
bool SAFE_MATH=false>
1661 template<jit::complex_scalar T,
bool SAFE_MATH=false>
1663 return std::dynamic_pointer_cast<erfi_node<T, SAFE_MATH>> (x);
Class representing a generic buffer.
Definition backend.hpp:29
void erfi()
Take erfi.
Definition backend.hpp:259
void log()
Take log.
Definition backend.hpp:232
void sqrt()
Take sqrt.
Definition backend.hpp:214
void pow_col(const buffer< T > &x)
Pow col operation.
Definition backend.hpp:747
void pow_row(const buffer< T > &x)
Pow row operation.
Definition backend.hpp:711
void exp()
Take exp.
Definition backend.hpp:223
Class representing a branch node.
Definition node.hpp:1165
shared_leaf< T, SAFE_MATH > right
Right branch of the tree.
Definition node.hpp:1170
shared_leaf< T, SAFE_MATH > left
Left branch of the tree.
Definition node.hpp:1168
An imaginary error function node.
Definition math.hpp:1440
erfi_node(shared_leaf< T, SAFE_MATH > x)
Construct a exp node.
Definition math.hpp:1458
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce the erfi(x).
Definition math.hpp:1479
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition math.hpp:1534
virtual void to_latex() const
Convert the node to latex.
Definition math.hpp:1577
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition math.hpp:1588
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition math.hpp:1511
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition math.hpp:1561
virtual backend::buffer< T > evaluate()
Evaluate the results of erfi.
Definition math.hpp:1468
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition math.hpp:1602
A exp node.
Definition math.hpp:337
virtual backend::buffer< T > evaluate()
Evaluate the results of exp.
Definition math.hpp:365
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition math.hpp:414
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition math.hpp:485
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition math.hpp:512
exp_node(shared_leaf< T, SAFE_MATH > x)
Construct a exp node.
Definition math.hpp:355
virtual void to_latex() const
Convert the node to latex.
Definition math.hpp:501
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce the exp(x).
Definition math.hpp:376
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition math.hpp:526
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition math.hpp:436
Class representing a node leaf.
Definition node.hpp:364
virtual void endline(std::ostringstream &stream, const jit::register_usage &usage) const final
End a line in the kernel source.
Definition node.hpp:639
std::map< size_t, std::shared_ptr< leaf_node< T, SAFE_MATH > > > df_cache
Cache derivative terms.
Definition node.hpp:371
virtual bool has_pseudo() const
Query if the node contains pseudo variables.
Definition node.hpp:620
const size_t hash
Hash for node.
Definition node.hpp:367
A log node.
Definition math.hpp:602
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition math.hpp:769
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition math.hpp:679
virtual backend::buffer< T > evaluate()
Evaluate the results of log.
Definition math.hpp:630
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition math.hpp:728
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce the log(x).
Definition math.hpp:641
virtual void to_latex() const
Convert the node to latex.
Definition math.hpp:744
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition math.hpp:701
log_node(shared_leaf< T, SAFE_MATH > x)
Construct a log node.
Definition math.hpp:620
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition math.hpp:755
An power node.
Definition math.hpp:844
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition math.hpp:1281
virtual bool is_all_variables() const
Test if node acts like a variable.
Definition math.hpp:1303
virtual shared_leaf< T, SAFE_MATH > get_power_base()
Get the base of a power.
Definition math.hpp:1323
virtual backend::buffer< T > evaluate()
Evaluate the results of addition.
Definition math.hpp:878
pow_node(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Construct an power node.
Definition math.hpp:866
virtual bool is_power_like() const
Test if the node acts like a power of variable.
Definition math.hpp:1314
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition math.hpp:1199
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition math.hpp:1341
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition math.hpp:1241
virtual shared_leaf< T, SAFE_MATH > get_power_exponent() const
Get the exponent of a power.
Definition math.hpp:1332
virtual void to_latex() const
Convert the node to latex.
Definition math.hpp:1258
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce a power node.
Definition math.hpp:889
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition math.hpp:1175
A sqrt node.
Definition math.hpp:26
virtual shared_leaf< T, SAFE_MATH > get_power_exponent() const
Get the exponent of a power.
Definition math.hpp:238
virtual backend::buffer< T > evaluate()
Evaluate the results of sqrt.
Definition math.hpp:54
virtual shared_leaf< T, SAFE_MATH > reduce()
Reduce the sqrt(x).
Definition math.hpp:65
sqrt_node(shared_leaf< T, SAFE_MATH > x)
Construct a sqrt node.
Definition math.hpp:44
virtual bool is_power_like() const
Test if the node acts like a power of variable.
Definition math.hpp:220
virtual bool is_match(shared_leaf< T, SAFE_MATH > x)
Query if the nodes match.
Definition math.hpp:193
virtual shared_leaf< T, SAFE_MATH > compile(std::ostringstream &stream, jit::register_map ®isters, jit::register_map &indices, const jit::register_usage &usage)
Compile the node.
Definition math.hpp:166
virtual shared_leaf< T, SAFE_MATH > remove_pseudo()
Remove pseudo variable nodes.
Definition math.hpp:247
virtual shared_leaf< T, SAFE_MATH > df(shared_leaf< T, SAFE_MATH > x)
Transform node to derivative.
Definition math.hpp:143
virtual shared_leaf< T, SAFE_MATH > to_vizgraph(std::stringstream &stream, jit::register_map ®isters)
Convert the node to vizgraph.
Definition math.hpp:261
virtual void to_latex() const
Convert the node to latex.
Definition math.hpp:209
virtual shared_leaf< T, SAFE_MATH > get_power_base()
Get the base of a power.
Definition math.hpp:229
Class representing a straight node.
Definition node.hpp:1051
shared_leaf< T, SAFE_MATH > arg
Argument.
Definition node.hpp:1054
Complex scalar concept.
Definition register.hpp:24
subroutine assert(test, message)
Assert check.
Definition f_binding_test.f90:38
buffer< T > pow(buffer< T > &base, buffer< T > &exponent)
Take the power.
Definition backend.hpp:1057
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:1428
shared_leaf< T, SAFE_MATH > log(shared_leaf< T, SAFE_MATH > x)
Define log convenience function.
Definition math.hpp:795
shared_pow< T, SAFE_MATH > pow_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a power node.
Definition math.hpp:1424
constexpr shared_leaf< T, SAFE_MATH > zero()
Forward declare for zero.
Definition node.hpp:986
shared_sqrt< T, SAFE_MATH > sqrt_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a sqrt node.
Definition math.hpp:321
shared_leaf< T, SAFE_MATH > pow(shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r)
Build power node.
Definition math.hpp:1360
shared_divide< T, SAFE_MATH > divide_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a divide node.
Definition arithmetic.hpp:3720
std::shared_ptr< erfi_node< T, SAFE_MATH > > shared_erfi
Convenience type alias for shared exp nodes.
Definition math.hpp:1650
shared_piecewise_1D< T, SAFE_MATH > piecewise_1D_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a piecewise 1D node.
Definition piecewise.hpp:637
shared_multiply< T, SAFE_MATH > multiply_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a multiply node.
Definition arithmetic.hpp:2755
shared_leaf< T, SAFE_MATH > exp(shared_leaf< T, SAFE_MATH > x)
Define exp convenience function.
Definition math.hpp:552
shared_exp< T, SAFE_MATH > exp_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a exp node.
Definition math.hpp:586
shared_constant< T, SAFE_MATH > constant_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a constant node.
Definition node.hpp:1034
shared_leaf< T, SAFE_MATH > erfi(shared_leaf< T, SAFE_MATH > x)
Define erfi convenience function.
Definition math.hpp:1628
bool is_variable_combinable(shared_leaf< T, SAFE_MATH > a, shared_leaf< T, SAFE_MATH > b)
Check if the variable is combinable.
Definition arithmetic.hpp:75
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:1727
constexpr T i
Convenience type for imaginary constant.
Definition node.hpp:1018
shared_erfi< T, SAFE_MATH > erfi_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a exp node.
Definition math.hpp:1662
shared_leaf< T, SAFE_MATH > sqrt(shared_leaf< T, SAFE_MATH > x)
Define sqrt convenience function.
Definition math.hpp:287
std::shared_ptr< exp_node< T, SAFE_MATH > > shared_exp
Convenience type alias for shared exp nodes.
Definition math.hpp:574
shared_log< T, SAFE_MATH > log_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a exp node.
Definition math.hpp:828
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:676
std::shared_ptr< log_node< T, SAFE_MATH > > shared_log
Convenience type alias for shared log nodes.
Definition math.hpp:816
std::shared_ptr< pow_node< T, SAFE_MATH > > shared_pow
Convenience type alias for shared add nodes.
Definition math.hpp:1415
std::shared_ptr< sqrt_node< T, SAFE_MATH > > shared_sqrt
Convenience type alias for shared sqrt nodes.
Definition math.hpp:309
std::string format_to_string(const T value)
Convert a value to a string while avoiding locale.
Definition register.hpp:212
std::map< void *, size_t > register_usage
Type alias for counting register usage.
Definition register.hpp:259
std::map< void *, std::string > register_map
Type alias for mapping node pointers to register names.
Definition register.hpp:257
std::string to_string(const char prefix, const NODE *pointer)
Convert a graph::leaf_node pointer to a string.
Definition register.hpp:246
Base nodes of graph computation framework.
void piecewise_1D()
Tests for 1D piecewise nodes.
Definition piecewise_test.cpp:80
void piecewise_2D()
Tests for 2D piecewise nodes.
Definition piecewise_test.cpp:319