adeeconometrics / AutoDiff

Implementation of Auto Differentiation
https://adeeconometrics.github.io/AutoDiff/
MIT License
0 stars 0 forks source link

Add unittesting #7

Open adeeconometrics opened 6 months ago

adeeconometrics commented 6 months ago
Function Forward Mode Reverse Mode Scalar Vector Matrix
arithmetic
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
exp
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
pow
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
ln
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
sin
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
cos
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
tan
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
cot
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
sec
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
csc
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
asin
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
acos
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
atan
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
acot
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
asec
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
acsc
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
sinh
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
cosh
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
tanh
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
coth
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
sech
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
csch
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
asinh
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
acosh
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
atanh
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
acoth
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
asech
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
acsch
  • - [x]
  • - [x]
  • - [x]
  • - [ ]
  • - [ ]
adeeconometrics commented 6 months ago

Review for handling domain errors in inverse and inverse hyperbolic derivative rules

Example:

// WARNING: Domain error should be handled in the future
TEST(RSymbol, AcscScalar) {
  ad::RSym a{0.5}; // should include multivariate tests

  auto c = acsc(a);

  const auto df_c = ad::gradient(c);

  EXPECT_DOUBLE_EQ(c.value(), 1.0 / std::asin(0.5));
  EXPECT_DOUBLE_EQ(df_c.at(a),
                   -1.0 / (std::sqrt(1 - std::pow(0.5, 2)) * std::abs(0.5)));
}