From 77db7cd2292ca7639a165a32785b42607748f31e Mon Sep 17 00:00:00 2001 From: Konrad1991 Date: Mon, 3 Jun 2024 16:07:39 +0200 Subject: [PATCH] added divide. now for the basic arithmetic operations dervis can be calculated --- include/etr_bits/Vector/DerivativeCalc.hpp | 13 +++++++++++++ tests/Derivatives_Tests.cpp | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/include/etr_bits/Vector/DerivativeCalc.hpp b/include/etr_bits/Vector/DerivativeCalc.hpp index fa4f498..a7512d3 100644 --- a/include/etr_bits/Vector/DerivativeCalc.hpp +++ b/include/etr_bits/Vector/DerivativeCalc.hpp @@ -60,6 +60,19 @@ static constexpr auto walkTD() { TimesDerivTrait>(); } +template + requires IsDivide +static constexpr auto walkTD() { + using TDDivision = std::remove_const_t>; + constexpr auto LT = produceVariableType(); + constexpr auto RT = produceVariableType(); + constexpr auto LDeriv = walkTD(); + constexpr auto RDeriv = walkTD(); + return produceQuarternyType(); +} + template requires IsAddition static constexpr auto walkTD() { diff --git a/tests/Derivatives_Tests.cpp b/tests/Derivatives_Tests.cpp index dc93a55..8a79c13 100644 --- a/tests/Derivatives_Tests.cpp +++ b/tests/Derivatives_Tests.cpp @@ -66,5 +66,13 @@ int main() { print(b, av); print(get_derivs(a)); print(get_derivs(b)); + + std::cout << "\n" + << "a = a / b" << std::endl; + a = a / b; + print(a, av); + print(b, av); + print(get_derivs(a)); + print(get_derivs(b)); } }