9 #ifndef __SUM_DERIVATIVES_H 10 #define __SUM_DERIVATIVES_H 12 #include "../Core/SharedLibraryExportMacros.h" 13 #include "../Core/Functions.h" 42 bool delete_inputs=
true)
43 : q1_deriv(derivative1), q2_deriv(derivative2),
44 destroy_derivs(delete_inputs) {}
47 double order(
unsigned deriv_order=1)
const 48 {
return q1_deriv->
order(deriv_order)+q2_deriv->
order(deriv_order);}
52 {
if(destroy_derivs) {
delete q1_deriv;
delete q2_deriv;}}
~SumDerivatives()
Clean up.
bool destroy_derivs
Whether to delete the input derivative when the object is destroyed.
virtual double order(unsigned deriv_order=1) const =0
Derivative of the given order of the function with respect to its argument.
SumDerivatives(const FunctionDerivatives *derivative1, const FunctionDerivatives *derivative2, bool delete_inputs=true)
Create a derivative object for a sum of two quantities: q1+q2.
A class representing arbitrary order derivatives of a function.
double order(unsigned deriv_order=1) const
The deriv_order-th derivative.
const FunctionDerivatives * q2_deriv
The derivatives of the second quantity in the sum.
Derivative class for a quantity that is the sum of two other quantities.