mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#include <poincare/normal_distribution_function.h>
|
|
#include <poincare/normal_distribution.h>
|
|
#include <assert.h>
|
|
|
|
namespace Poincare {
|
|
|
|
Expression NormalDistributionFunctionNode::shallowReduce(ReductionContext reductionContext) {
|
|
return NormalDistributionFunction(this).shallowReduce(reductionContext.context());
|
|
}
|
|
|
|
Expression NormalDistributionFunction::shallowReduce(Context * context, bool * stopReduction) {
|
|
if (stopReduction != nullptr) {
|
|
*stopReduction = true;
|
|
}
|
|
{
|
|
Expression e = Expression::defaultShallowReduce();
|
|
if (e.isUndefined()) {
|
|
return e;
|
|
}
|
|
}
|
|
|
|
Expression mu = childAtIndex(1);
|
|
Expression var = childAtIndex(2);
|
|
|
|
// Check mu and var
|
|
bool muAndVarOK = false;
|
|
bool couldCheckMuAndVar = NormalDistribution::ExpressionParametersAreOK(&muAndVarOK, mu, var, context);
|
|
if (!couldCheckMuAndVar) {
|
|
return *this;
|
|
}
|
|
if (!muAndVarOK) {
|
|
return replaceWithUndefinedInPlace();
|
|
}
|
|
|
|
if (stopReduction != nullptr) {
|
|
*stopReduction = false;
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
}
|