mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare] Add ReductionContext to unaryFunctionDifferential
Change-Id: I99ba90f8c38cab5d8fe2139f49e4f94c1d52d296
This commit is contained in:
committed by
EmilieNumworks
parent
f54c5a8172
commit
f329ca825f
@@ -35,7 +35,7 @@ private:
|
||||
|
||||
// Derivation
|
||||
bool derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) override;
|
||||
Expression unaryFunctionDifferential() override;
|
||||
Expression unaryFunctionDifferential(ReductionContext reductionContext) override;
|
||||
|
||||
// Evaluation
|
||||
Evaluation<float> approximate(SinglePrecision p, ApproximationContext approximationContext) const override {
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue);
|
||||
Expression unaryFunctionDifferential();
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
static Derivative Builder(Expression child0, Symbol child1, Expression child2) { return TreeHandle::FixedArityBuilder<Derivative, DerivativeNode>({child0, child1, child2}); }
|
||||
static Expression UntypedBuilder(Expression children);
|
||||
static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("diff", 3, &UntypedBuilder);
|
||||
static void DerivateUnaryFunction(Expression function, Expression symbol, Expression symbolValue);
|
||||
static void DerivateUnaryFunction(Expression function, Expression symbol, Expression symbolValue, ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
Expression shallowReduce(ExpressionNode::ReductionContext context);
|
||||
};
|
||||
|
||||
@@ -400,7 +400,7 @@ protected:
|
||||
* It returns whether the instance is differentiable, and differentiates it if
|
||||
* able. */
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue) { return node()->derivate(reductionContext, symbol, symbolValue); }
|
||||
Expression unaryFunctionDifferential() { return node()->unaryFunctionDifferential(); }
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext) { return node()->unaryFunctionDifferential(reductionContext); }
|
||||
|
||||
private:
|
||||
static constexpr int k_maxSymbolReplacementsCount = 10;
|
||||
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
* the reduction context. */
|
||||
/*!*/ virtual Expression shallowBeautify(ReductionContext * reductionContext);
|
||||
/*!*/ virtual bool derivate(ReductionContext, Expression symbol, Expression symbolValue);
|
||||
virtual Expression unaryFunctionDifferential();
|
||||
virtual Expression unaryFunctionDifferential(ReductionContext reductionContext);
|
||||
/* Return a clone of the denominator part of the expression */
|
||||
/*!*/ virtual Expression denominator(ExpressionNode::ReductionContext reductionContext) const;
|
||||
/* LayoutShape is used to check if the multiplication sign can be omitted between two expressions. It depends on the "layout syle" of the on the right of the left expression */
|
||||
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
// Derivation
|
||||
bool derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) override;
|
||||
Expression unaryFunctionDifferential() override;
|
||||
Expression unaryFunctionDifferential(ReductionContext reductionContext) override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, ApproximationContext approximationContext) const override {
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
static HyperbolicCosine Builder(Expression child) { return TreeHandle::FixedArityBuilder<HyperbolicCosine, HyperbolicCosineNode>({child}); }
|
||||
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue);
|
||||
Expression unaryFunctionDifferential();
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("cosh", 1, &UntypedBuilderOneChild<HyperbolicCosine>);
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ private:
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
// Derivation
|
||||
bool derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) override;
|
||||
Expression unaryFunctionDifferential() override;
|
||||
Expression unaryFunctionDifferential(ReductionContext reductionContext) override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, ApproximationContext approximationContext) const override {
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
static HyperbolicSine Builder(Expression child) { return TreeHandle::FixedArityBuilder<HyperbolicSine, HyperbolicSineNode>({child}); }
|
||||
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue);
|
||||
Expression unaryFunctionDifferential();
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("sinh", 1, &UntypedBuilderOneChild<HyperbolicSine>);
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ private:
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
|
||||
// Derivation
|
||||
bool derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) override;
|
||||
Expression unaryFunctionDifferential() override;
|
||||
Expression unaryFunctionDifferential(ReductionContext reductionContext) override;
|
||||
//Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit);
|
||||
Evaluation<float> approximate(SinglePrecision p, ApproximationContext approximationContext) const override {
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
static HyperbolicTangent Builder(Expression child) { return TreeHandle::FixedArityBuilder<HyperbolicTangent, HyperbolicTangentNode>({child}); }
|
||||
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue);
|
||||
Expression unaryFunctionDifferential();
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("tanh", 1, &UntypedBuilderOneChild<HyperbolicTangent>);
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
LayoutShape rightLayoutShape() const override { return LayoutShape::BoundaryPunctuation; }
|
||||
// Derivation
|
||||
bool derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) override;
|
||||
Expression unaryFunctionDifferential() override;
|
||||
Expression unaryFunctionDifferential(ReductionContext reductionContext) override;
|
||||
// Evaluation
|
||||
template<typename U> static Complex<U> computeOnComplex(const std::complex<U> c, Preferences::ComplexFormat, Preferences::AngleUnit angleUnit) {
|
||||
/* log has a branch cut on ]-inf, 0]: it is then multivalued on this cut. We
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
|
||||
Expression shallowBeautify();
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue);
|
||||
Expression unaryFunctionDifferential();
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
private:
|
||||
void deepReduceChildren(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
|
||||
// Derivation
|
||||
bool derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) override;
|
||||
Expression unaryFunctionDifferential() override;
|
||||
Expression unaryFunctionDifferential(ReductionContext reductionContext) override;
|
||||
|
||||
// Evaluation
|
||||
Evaluation<float> approximate(SinglePrecision p, ApproximationContext approximationContext) const override {
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue);
|
||||
Expression unaryFunctionDifferential();
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
|
||||
// Derivation
|
||||
bool derivate(ReductionContext reductionContext, Expression symbol, Expression symbolValue) override;
|
||||
Expression unaryFunctionDifferential() override;
|
||||
Expression unaryFunctionDifferential(ReductionContext reductionContext) override;
|
||||
|
||||
// Evaluation
|
||||
template<typename T> static Complex<T> computeOnComplex(const std::complex<T> c, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit = Preferences::AngleUnit::Radian);
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
|
||||
|
||||
bool derivate(ExpressionNode::ReductionContext reductionContext, Expression symbol, Expression symbolValue);
|
||||
Expression unaryFunctionDifferential();
|
||||
Expression unaryFunctionDifferential(ExpressionNode::ReductionContext reductionContext);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user