mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Refactor the first lines of shallowReduce
This commit is contained in:
@@ -28,8 +28,8 @@ LayoutRef AbsoluteValue::createLayout(Preferences::PrintFloatMode floatDisplayMo
|
||||
}
|
||||
|
||||
Expression AbsoluteValue::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -18,8 +18,8 @@ Expression * ArcSine::clone() const {
|
||||
}
|
||||
|
||||
Expression ArcSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -18,8 +18,8 @@ Expression * ArcTangent::clone() const {
|
||||
}
|
||||
|
||||
Expression ArcTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -21,8 +21,8 @@ Expression * BinomialCoefficient::clone() const {
|
||||
}
|
||||
|
||||
Expression BinomialCoefficient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -21,8 +21,8 @@ Expression * Ceiling::clone() const {
|
||||
}
|
||||
|
||||
Expression Ceiling::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -17,8 +17,8 @@ Expression * ComplexArgument::clone() const {
|
||||
}
|
||||
|
||||
Expression ComplexArgument::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -25,8 +25,8 @@ int ConfidenceInterval::polynomialDegree(char symbolName) const {
|
||||
}
|
||||
|
||||
Expression ConfidenceInterval::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -20,8 +20,8 @@ LayoutRef Conjugate::createLayout(Preferences::PrintFloatMode floatDisplayMode,
|
||||
}
|
||||
|
||||
Expression Conjugate::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -17,8 +17,8 @@ Expression * Determinant::clone() const {
|
||||
}
|
||||
|
||||
Expression Determinant::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -19,8 +19,8 @@ Expression * DivisionQuotient::clone() const {
|
||||
}
|
||||
|
||||
Expression DivisionQuotient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -19,8 +19,8 @@ Expression * DivisionRemainder::clone() const {
|
||||
}
|
||||
|
||||
Expression DivisionRemainder::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -39,8 +39,8 @@ Expression * Equal::standardEquation(Context & context, Preferences::AngleUnit a
|
||||
}
|
||||
|
||||
Expression Equal::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
if (operand(0)->isIdenticalTo(operand(1))) {
|
||||
|
||||
@@ -37,8 +37,8 @@ bool Factorial::needsParenthesesWithParent(const SerializationHelperInterface *
|
||||
/* Simplification */
|
||||
|
||||
Expression Factorial::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -21,8 +21,8 @@ Expression * Floor::clone() const {
|
||||
}
|
||||
|
||||
Expression Floor::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -18,8 +18,8 @@ Expression * FracPart::clone() const {
|
||||
}
|
||||
|
||||
Expression FracPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -20,8 +20,8 @@ Expression * GreatCommonDivisor::clone() const {
|
||||
}
|
||||
|
||||
Expression GreatCommonDivisor::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -18,8 +18,8 @@ Expression * HyperbolicArcCosine::clone() const {
|
||||
}
|
||||
|
||||
Expression HyperbolicArcCosine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -18,8 +18,8 @@ Expression * HyperbolicArcSine::clone() const {
|
||||
}
|
||||
|
||||
Expression HyperbolicArcSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -18,8 +18,8 @@ Expression * HyperbolicArcTangent::clone() const {
|
||||
}
|
||||
|
||||
Expression HyperbolicArcTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -22,8 +22,8 @@ Expression * HyperbolicCosine::clone() const {
|
||||
}
|
||||
|
||||
Expression HyperbolicCosine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -22,8 +22,8 @@ Expression * HyperbolicSine::clone() const {
|
||||
}
|
||||
|
||||
Expression HyperbolicSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -21,8 +21,8 @@ Expression * HyperbolicTangent::clone() const {
|
||||
}
|
||||
|
||||
Expression HyperbolicTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -19,8 +19,8 @@ Expression * ImaginaryPart::clone() const {
|
||||
|
||||
|
||||
Expression ImaginaryPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -32,8 +32,8 @@ int Integral::polynomialDegree(char symbolName) const {
|
||||
}
|
||||
|
||||
Expression Integral::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -20,8 +20,8 @@ Expression * LeastCommonMultiple::clone() const {
|
||||
}
|
||||
|
||||
Expression LeastCommonMultiple::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -17,8 +17,8 @@ Expression * MatrixDimension::clone() const {
|
||||
}
|
||||
|
||||
Expression MatrixDimension::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
@@ -20,8 +20,8 @@ Expression * MatrixInverse::clone() const {
|
||||
}
|
||||
|
||||
Expression MatrixInverse::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -19,8 +19,8 @@ Expression * MatrixTrace::clone() const {
|
||||
}
|
||||
|
||||
Expression MatrixTrace::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -18,8 +18,8 @@ Expression * MatrixTranspose::clone() const {
|
||||
}
|
||||
|
||||
Expression MatrixTranspose::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -19,8 +19,8 @@ Expression * PermuteCoefficient::clone() const {
|
||||
}
|
||||
|
||||
Expression PermuteCoefficient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -26,8 +26,8 @@ int PredictionInterval::polynomialDegree(char symbolName) const {
|
||||
}
|
||||
|
||||
Expression PredictionInterval::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op0 = editableOperand(0);
|
||||
|
||||
@@ -17,8 +17,8 @@ Expression * RealPart::clone() const {
|
||||
}
|
||||
|
||||
Expression RealPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
Expression * op = editableOperand(0);
|
||||
|
||||
@@ -20,8 +20,8 @@ Expression * Round::clone() const {
|
||||
}
|
||||
|
||||
Expression Round::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
|
||||
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e != this) {
|
||||
Expression e = Expression::defaultShallowReduce(context, angleUnit);
|
||||
if (e.isUndefinedOrAllocationFailure()) {
|
||||
return e;
|
||||
}
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
Reference in New Issue
Block a user