mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[upstream_utils] Update Sleipnir (#6709)
Upstream now uses std::format/std::print, so we have to backport it to fmtlib.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tyler Veness <calcmogul@gmail.com>
|
||||
Date: Wed, 24 Apr 2024 15:56:06 -0700
|
||||
Subject: [PATCH 1/2] Remove "using enum" declarations
|
||||
Subject: [PATCH 1/4] Remove "using enum" declarations
|
||||
|
||||
---
|
||||
include/sleipnir/autodiff/Expression.hpp | 161 +++++++-----------
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH 1/2] Remove "using enum" declarations
|
||||
2 files changed, 73 insertions(+), 110 deletions(-)
|
||||
|
||||
diff --git a/include/sleipnir/autodiff/Expression.hpp b/include/sleipnir/autodiff/Expression.hpp
|
||||
index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45d27916cb 100644
|
||||
index 5b8dc5dca9bd685e6647e79f5fd4699bb9909853..802a8602a125251058cfe22447911999f035efad 100644
|
||||
--- a/include/sleipnir/autodiff/Expression.hpp
|
||||
+++ b/include/sleipnir/autodiff/Expression.hpp
|
||||
@@ -192,8 +192,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -191,8 +191,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
*/
|
||||
friend SLEIPNIR_DLLEXPORT ExpressionPtr operator*(const ExpressionPtr& lhs,
|
||||
const ExpressionPtr& rhs) {
|
||||
@@ -21,7 +21,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (lhs->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -208,20 +206,22 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -207,20 +205,22 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -50,7 +50,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
}
|
||||
|
||||
return MakeExpressionPtr(
|
||||
@@ -247,8 +247,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -246,8 +246,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
*/
|
||||
friend SLEIPNIR_DLLEXPORT ExpressionPtr operator/(const ExpressionPtr& lhs,
|
||||
const ExpressionPtr& rhs) {
|
||||
@@ -59,7 +59,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (lhs->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -258,16 +256,17 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -257,16 +255,17 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -80,7 +80,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
}
|
||||
|
||||
return MakeExpressionPtr(
|
||||
@@ -295,8 +294,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -294,8 +293,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
*/
|
||||
friend SLEIPNIR_DLLEXPORT ExpressionPtr operator+(const ExpressionPtr& lhs,
|
||||
const ExpressionPtr& rhs) {
|
||||
@@ -89,7 +89,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (lhs == nullptr || lhs->IsConstant(0.0)) {
|
||||
return rhs;
|
||||
@@ -305,7 +302,8 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -304,7 +301,8 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -99,7 +99,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
return MakeExpressionPtr(lhs->value + rhs->value);
|
||||
}
|
||||
|
||||
@@ -333,8 +331,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -332,8 +330,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
*/
|
||||
friend SLEIPNIR_DLLEXPORT ExpressionPtr operator-(const ExpressionPtr& lhs,
|
||||
const ExpressionPtr& rhs) {
|
||||
@@ -108,7 +108,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (lhs->IsConstant(0.0)) {
|
||||
if (rhs->IsConstant(0.0)) {
|
||||
@@ -348,7 +344,8 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -347,7 +343,8 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -118,7 +118,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
return MakeExpressionPtr(lhs->value - rhs->value);
|
||||
}
|
||||
|
||||
@@ -374,8 +371,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -373,8 +370,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
* @param lhs Operand of unary minus.
|
||||
*/
|
||||
friend SLEIPNIR_DLLEXPORT ExpressionPtr operator-(const ExpressionPtr& lhs) {
|
||||
@@ -127,7 +127,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (lhs->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -383,7 +378,7 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
@@ -382,7 +377,7 @@ struct SLEIPNIR_DLLEXPORT Expression {
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -136,7 +136,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
return MakeExpressionPtr(-lhs->value);
|
||||
}
|
||||
|
||||
@@ -465,8 +460,6 @@ inline void IntrusiveSharedPtrDecRefCount(Expression* expr) {
|
||||
@@ -463,8 +458,6 @@ inline constexpr void IntrusiveSharedPtrDecRefCount(Expression* expr) {
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr abs( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -145,7 +145,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -474,12 +467,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr abs( // NOLINT
|
||||
@@ -472,12 +465,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr abs( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -160,7 +160,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
if (x < 0.0) {
|
||||
return -parentAdjoint;
|
||||
@@ -510,20 +503,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr abs( // NOLINT
|
||||
@@ -508,20 +501,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr abs( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr acos( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -183,7 +183,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return -parentAdjoint / std::sqrt(1.0 - x * x);
|
||||
},
|
||||
@@ -542,8 +533,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr acos( // NOLINT
|
||||
@@ -540,8 +531,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr acos( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr asin( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -192,7 +192,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -551,12 +540,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr asin( // NOLINT
|
||||
@@ -549,12 +538,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr asin( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -207,7 +207,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint / std::sqrt(1.0 - x * x);
|
||||
},
|
||||
@@ -575,8 +564,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr asin( // NOLINT
|
||||
@@ -573,8 +562,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr asin( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr atan( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -216,7 +216,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -584,12 +571,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan( // NOLINT
|
||||
@@ -582,12 +569,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -231,7 +231,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint / (1.0 + x * x);
|
||||
},
|
||||
@@ -608,8 +595,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan( // NOLINT
|
||||
@@ -606,8 +593,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr atan2( // NOLINT
|
||||
const ExpressionPtr& y, const ExpressionPtr& x) {
|
||||
@@ -240,7 +240,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (y->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -619,12 +604,14 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan2( // NOLINT
|
||||
@@ -617,12 +602,14 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan2( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -257,7 +257,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double y, double x, double parentAdjoint) {
|
||||
return parentAdjoint * x / (y * y + x * x);
|
||||
},
|
||||
@@ -649,20 +636,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan2( // NOLINT
|
||||
@@ -647,20 +634,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr atan2( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr cos( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -280,7 +280,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return -parentAdjoint * std::sin(x);
|
||||
},
|
||||
@@ -680,20 +665,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr cos( // NOLINT
|
||||
@@ -678,20 +663,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr cos( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr cosh( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -303,7 +303,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint * std::sinh(x);
|
||||
},
|
||||
@@ -711,8 +694,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr cosh( // NOLINT
|
||||
@@ -709,8 +692,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr cosh( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr erf( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -312,7 +312,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -720,12 +701,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr erf( // NOLINT
|
||||
@@ -718,12 +699,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr erf( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -327,7 +327,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint * 2.0 * std::numbers::inv_sqrtpi *
|
||||
std::exp(-x * x);
|
||||
@@ -746,20 +727,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr erf( // NOLINT
|
||||
@@ -744,20 +725,18 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr erf( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr exp( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -350,7 +350,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint * std::exp(x);
|
||||
},
|
||||
@@ -778,8 +757,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr exp( // NOLINT
|
||||
@@ -776,8 +755,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr exp( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr hypot( // NOLINT
|
||||
const ExpressionPtr& x, const ExpressionPtr& y) {
|
||||
@@ -359,7 +359,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
return y;
|
||||
@@ -788,12 +765,14 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr hypot( // NOLINT
|
||||
@@ -786,12 +763,14 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr hypot( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -376,7 +376,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double y, double parentAdjoint) {
|
||||
return parentAdjoint * x / std::hypot(x, y);
|
||||
},
|
||||
@@ -818,8 +797,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr hypot( // NOLINT
|
||||
@@ -816,8 +795,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr hypot( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr log( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -385,7 +385,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -827,12 +804,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log( // NOLINT
|
||||
@@ -825,12 +802,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -400,7 +400,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) { return parentAdjoint / x; },
|
||||
[](const ExpressionPtr& x, const ExpressionPtr&,
|
||||
const ExpressionPtr& parentAdjoint) { return parentAdjoint / x; },
|
||||
@@ -846,8 +823,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log( // NOLINT
|
||||
@@ -844,8 +821,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr log10( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -409,7 +409,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -855,12 +830,13 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log10( // NOLINT
|
||||
@@ -853,12 +828,13 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log10( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -425,7 +425,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint / (std::numbers::ln10 * x);
|
||||
},
|
||||
@@ -879,8 +855,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log10( // NOLINT
|
||||
@@ -877,8 +853,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr log10( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr pow( // NOLINT
|
||||
const ExpressionPtr& base, const ExpressionPtr& power) {
|
||||
@@ -434,7 +434,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (base->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -895,12 +869,15 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr pow( // NOLINT
|
||||
@@ -893,12 +867,15 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr pow( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -452,7 +452,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double base, double power) { return std::pow(base, power); },
|
||||
[](double base, double power, double parentAdjoint) {
|
||||
return parentAdjoint * std::pow(base, power - 1) * power;
|
||||
@@ -941,10 +918,8 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr pow( // NOLINT
|
||||
@@ -939,10 +916,8 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr pow( // NOLINT
|
||||
* @param x The argument.
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr sign(const ExpressionPtr& x) {
|
||||
@@ -464,7 +464,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
if (x->value < 0.0) {
|
||||
return MakeExpressionPtr(-1.0);
|
||||
} else if (x->value == 0.0) {
|
||||
@@ -956,7 +931,7 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sign(const ExpressionPtr& x) {
|
||||
@@ -954,7 +929,7 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sign(const ExpressionPtr& x) {
|
||||
}
|
||||
|
||||
return MakeExpressionPtr(
|
||||
@@ -473,7 +473,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double) {
|
||||
if (x < 0.0) {
|
||||
return -1.0;
|
||||
@@ -982,8 +957,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sign(const ExpressionPtr& x) {
|
||||
@@ -980,8 +955,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sign(const ExpressionPtr& x) {
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr sin( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -482,7 +482,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -991,12 +964,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sin( // NOLINT
|
||||
@@ -989,12 +962,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sin( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -497,7 +497,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint * std::cos(x);
|
||||
},
|
||||
@@ -1013,8 +986,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sin( // NOLINT
|
||||
@@ -1011,8 +984,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sin( // NOLINT
|
||||
* @param x The argument.
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr sinh(const ExpressionPtr& x) {
|
||||
@@ -506,7 +506,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -1022,12 +993,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sinh(const ExpressionPtr& x) {
|
||||
@@ -1020,12 +991,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sinh(const ExpressionPtr& x) {
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -521,7 +521,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint * std::cosh(x);
|
||||
},
|
||||
@@ -1045,10 +1016,8 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sinh(const ExpressionPtr& x) {
|
||||
@@ -1043,10 +1014,8 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sinh(const ExpressionPtr& x) {
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr sqrt( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -533,7 +533,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
if (x->value == 0.0) {
|
||||
// Return zero
|
||||
return x;
|
||||
@@ -1060,7 +1029,7 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sqrt( // NOLINT
|
||||
@@ -1058,7 +1027,7 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sqrt( // NOLINT
|
||||
}
|
||||
|
||||
return MakeExpressionPtr(
|
||||
@@ -542,7 +542,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint / (2.0 * std::sqrt(x));
|
||||
},
|
||||
@@ -1079,8 +1048,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sqrt( // NOLINT
|
||||
@@ -1077,8 +1046,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr sqrt( // NOLINT
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr tan( // NOLINT
|
||||
const ExpressionPtr& x) {
|
||||
@@ -551,7 +551,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -1088,12 +1055,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr tan( // NOLINT
|
||||
@@ -1086,12 +1053,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr tan( // NOLINT
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
@@ -566,7 +566,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
[](double x, double, double parentAdjoint) {
|
||||
return parentAdjoint / (std::cos(x) * std::cos(x));
|
||||
},
|
||||
@@ -1111,8 +1078,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr tan( // NOLINT
|
||||
@@ -1109,8 +1076,6 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr tan( // NOLINT
|
||||
* @param x The argument.
|
||||
*/
|
||||
SLEIPNIR_DLLEXPORT inline ExpressionPtr tanh(const ExpressionPtr& x) {
|
||||
@@ -575,7 +575,7 @@ index b60226ccffef9ac161727483ebca3d53df09dec2..fc503c10a209b4779e204e598d3bae45
|
||||
// Prune expression
|
||||
if (x->IsConstant(0.0)) {
|
||||
// Return zero
|
||||
@@ -1120,12 +1085,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr tanh(const ExpressionPtr& x) {
|
||||
@@ -1118,12 +1083,12 @@ SLEIPNIR_DLLEXPORT inline ExpressionPtr tanh(const ExpressionPtr& x) {
|
||||
}
|
||||
|
||||
// Evaluate constant
|
||||
|
||||
Reference in New Issue
Block a user