Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matheclipse.core.basic.Config;
import org.matheclipse.core.basic.OperationSystem;
import org.matheclipse.core.builtin.Combinatoric.KPermutationsIterable;
import org.matheclipse.core.convert.JASConvert;
import org.matheclipse.core.convert.JASIExpr;
Expand Down Expand Up @@ -877,6 +878,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
}
return arg1;
} catch (Exception e) {
Errors.rethrowsInterruptException(e);
LOGGER.debug("Collect.evaluate() failed", e);
}
return F.NIL;
Expand Down Expand Up @@ -2332,6 +2334,7 @@ private static IExpr factor(IAST expr, VariablesSet eVar, boolean squareFree,
// } catch (TimeExceededException texex) {
// LOGGER.debug("Factor.factor() time limit exceeded", texex);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
LOGGER.debug("Factor.factor() failed", rex);
return expr;
}
Expand Down Expand Up @@ -2784,6 +2787,7 @@ private static IExpr factorList(IExpr expr, List<IExpr> varList, boolean factorS
map = factorAbstract.factors(poly);
}
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
// JAS may throw RuntimeExceptions
return F.list(expr);
}
Expand Down Expand Up @@ -3206,6 +3210,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
}
return F.NIL;
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
LOGGER.debug("PolynomialExtendedGCD.evaluate() failed", rex);
}
}
Expand Down Expand Up @@ -3341,6 +3346,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
// }
// return jas.exprPoly2Expr(p1);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
LOGGER.debug("PolynomialGCD.evaluate() failed", rex);
}
}
Expand Down Expand Up @@ -3507,6 +3513,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
}
return jas.exprPoly2Expr(p1);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
LOGGER.debug("PolynomialLCM.evaluate() failed", rex);
}
}
Expand Down Expand Up @@ -3798,6 +3805,7 @@ public static Optional<IExpr[]> quotientRemainder(final IExpr arg1, IExpr arg2,
} catch (LimitException le) {
throw le;
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
// rex.printStackTrace();
LOGGER.debug("PolynomialQuotientRemainder.quotientRemainder() failed", rex);
}
Expand Down Expand Up @@ -3873,6 +3881,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
// division by zero
LOGGER.log(engine.getLogLevel(), S.PolynomialQuotientRemainder, aex);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
LOGGER.debug("PolynomialQuotientRemainder.evaluate() failed", rex);
}
return F.NIL;
Expand Down Expand Up @@ -3990,6 +3999,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
// division by zero
LOGGER.log(engine.getLogLevel(), S.PolynomialRemainder, aex);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
LOGGER.debug("PolynomialRemainder.evaluate() failed", rex);
}
return F.NIL;
Expand Down Expand Up @@ -4786,6 +4796,7 @@ public static Optional<IExpr[]> cancelGCD(final IExpr numerator, final IExpr den
result[2] = substitutions.replaceBackward(result[2]);
return Optional.of(result);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);

}
List<IExpr> varList = eVar.getVarList().copyTo();
Expand Down Expand Up @@ -4817,6 +4828,7 @@ public static Optional<IExpr[]> cancelGCD(final IExpr numerator, final IExpr den
result[2] = substitutions.replaceBackward(result[2]);
return Optional.of(result);
} catch (RuntimeException e) {
Errors.rethrowsInterruptException(e);
LOGGER.debug("Algebra.cancelGCD() failed", e);
}
return Optional.empty();
Expand Down Expand Up @@ -5224,6 +5236,7 @@ private static IExpr factorComplex(IExpr expr, List<IExpr> varList, ISymbol head
return factorRational(polyRat, jas, head);
}
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
LOGGER.debug("Algebra.factorComplex() failed", rex);
}
return expr;
Expand Down Expand Up @@ -5303,6 +5316,7 @@ public static IAST factorModulus(JASModInteger jas, ModLongRing modIntegerRing,
map = factorAbstract.factors(poly);
}
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
// JAS may throw RuntimeExceptions
return F.NIL;
}
Expand Down Expand Up @@ -5909,6 +5923,7 @@ public static IExpr partialFractionDecompositionRational(IPartialFractionGenerat
return pf.getResult();
}
} catch (RuntimeException e) {
Errors.rethrowsInterruptException(e);
// JAS may throw JASConversionException and RuntimeExceptions
LOGGER.debug("Algebra.partialFractionDecompositionRational() failed", e);
}
Expand All @@ -5930,6 +5945,7 @@ public static ASTSeriesData polynomialTaylorSeries(IExpr[] parts, IExpr x, IExpr
}
return seriesData;
} catch (RuntimeException e) {
Errors.rethrowsInterruptException(e);
// JAS may throw JASConversionException and RuntimeExceptions
LOGGER.debug("Algebra.polynomialTaylorSeries() failed", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.hipparchus.linear.Array2DRowRealMatrix;
import org.hipparchus.linear.ArrayRealVector;
import org.matheclipse.core.basic.Config;
import org.matheclipse.core.basic.OperationSystem;
import org.matheclipse.core.eval.Errors;
import org.matheclipse.core.eval.EvalEngine;
import org.matheclipse.core.eval.PlusOp;
Expand Down Expand Up @@ -723,6 +724,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
try {
return F.subst(expr, x -> chopNumber(x, delta));
} catch (Exception e) {
Errors.rethrowsInterruptException(e);
LOGGER.debug("Chop.evaluate() failed", e);
}

Expand Down Expand Up @@ -876,6 +878,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
// }
}
} catch (Exception e) {
Errors.rethrowsInterruptException(e);
LOGGER.debug("Complex.evaluate() failed", e);
}

Expand Down Expand Up @@ -1119,6 +1122,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
try {
return F.num(h.cbrt(((IReal) base).apfloatValue()));
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
//
}
}
Expand Down Expand Up @@ -5131,6 +5135,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
return F.fraction(numerator, denominator);

} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.Rational, rex, engine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import static org.matheclipse.core.expression.F.Times;
import java.math.RoundingMode;
import org.hipparchus.complex.Complex;
import org.matheclipse.core.basic.OperationSystem;
import org.matheclipse.core.builtin.functions.BesselJS;
import org.matheclipse.core.eval.Errors;
import org.matheclipse.core.eval.EvalEngine;
Expand Down Expand Up @@ -536,6 +537,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
} catch (ValidateException ve) {
return Errors.printMessage(S.BesselJ, ve, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.BesselJ, rex, engine);
}
}
Expand Down Expand Up @@ -600,6 +602,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
return F.num(BesselJS.besselJZero(n.evalf(), k));
}
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
// org.hipparchus.exception.MathIllegalArgumentException:
// interval does not bracket a root
return Errors.printMessage(S.BesselJZero, rex, engine);
Expand Down Expand Up @@ -722,6 +725,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
} catch (ValidateException ve) {
return Errors.printMessage(ast.topHead(), ve, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.BesselI, rex, engine);
}
}
Expand Down Expand Up @@ -831,6 +835,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
} catch (ValidateException ve) {
return Errors.printMessage(S.BesselK, ve, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.BesselK, rex, engine);
}
}
Expand Down Expand Up @@ -941,6 +946,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
} catch (ValidateException ve) {
return Errors.printMessage(S.BesselY, ve, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.BesselY, rex, engine);
}
}
Expand Down Expand Up @@ -975,6 +981,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
return F.num(BesselJS.besselYZero(n.evalf(), k));
}
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
// org.hipparchus.exception.MathIllegalArgumentException: interval does not bracket a root
return Errors.printMessage(S.BesselYZero, rex, engine);
}
Expand Down Expand Up @@ -1035,6 +1042,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
}

} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.HankelH1, rex, engine);
}
} else if (engine.isArbitraryMode()) {
Expand Down Expand Up @@ -1095,6 +1103,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
}

} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.HankelH2, rex, engine);
}
} else if (engine.isArbitraryMode()) {
Expand Down Expand Up @@ -1205,6 +1214,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
}

} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.SphericalBesselJ, rex, engine);
}
}
Expand Down Expand Up @@ -1303,6 +1313,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
// return FunctionExpand.callMatcher(F.FunctionExpand(ast), ast, engine);
return functionExpand(ast, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.SphericalHankelH1, rex, engine);
}
}
Expand Down Expand Up @@ -1372,6 +1383,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
try {
return functionExpand(ast, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.SphericalHankelH2, rex, engine);
}
}
Expand Down Expand Up @@ -1458,6 +1470,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
return F.complexNum(BesselJS.sphericalBesselY(nDouble, zDouble));
}
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.SphericalBesselY, rex, engine);
}
}
Expand Down Expand Up @@ -1531,6 +1544,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
return FunctionExpand.callMatcher(F.FunctionExpand(ast), ast, engine);

} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.WeberE, rex, engine);
}
}
Expand All @@ -1545,6 +1559,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
try {
return FunctionExpand.callMatcher(F.FunctionExpand(ast), ast, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.WeberE, rex, engine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.logicng.transformations.cnf.CNFFactorization;
import org.logicng.transformations.dnf.DNFFactorization;
import org.logicng.transformations.simplification.AdvancedSimplifier;
import org.matheclipse.core.basic.OperationSystem;
import org.matheclipse.core.convert.VariablesSet;
import org.matheclipse.core.eval.Errors;
import org.matheclipse.core.eval.EvalAttributes;
Expand Down Expand Up @@ -1277,6 +1278,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
// int number validation
Errors.printMessage(ast.topHead(), ve, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);

}
return ast.arg1();
Expand Down Expand Up @@ -4904,7 +4906,7 @@ private static IExpr quantityEquals(IQuantity q1, IQuantity q2) {
return F.booleSymbol(q1.value().equals(q2.value()));
}
} catch (RuntimeException rex) {
//
Errors.rethrowsInterruptException(rex);
}
return F.NIL;
}
Expand All @@ -4929,7 +4931,7 @@ private static IExpr quantityUnequals(IQuantity q1, IQuantity q2) {
return F.booleSymbol(!q1.value().equals(q2.value()));
}
} catch (RuntimeException rex) {
//
Errors.rethrowsInterruptException(rex);
}
return F.NIL;
}
Expand All @@ -4955,7 +4957,7 @@ private static int quantityCompareTo(IQuantity q1, IQuantity q2) {
return q1.value().compareTo(q2.value());
}
} catch (RuntimeException rex) {
//
Errors.rethrowsInterruptException(rex);
}
return Integer.MIN_VALUE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Map;
import java.util.Set;
import org.matheclipse.core.basic.Config;
import org.matheclipse.core.basic.OperationSystem;
import org.matheclipse.core.combinatoric.KPartitionsIterable;
import org.matheclipse.core.combinatoric.KPartitionsList;
import org.matheclipse.core.combinatoric.KSubsetsIterable;
Expand Down Expand Up @@ -935,6 +936,7 @@ private static IExpr frobeniusPartition(final IAST ast, EvalEngine engine) {
} catch (LimitException le) {
throw le;
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
Errors.printMessage(S.IntegerPartitions, rex, engine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.codehaus.commons.compiler.CompileException;
import org.codehaus.janino.SimpleCompiler;
import org.matheclipse.core.basic.Config;
import org.matheclipse.core.basic.OperationSystem;
import org.matheclipse.core.basic.ToggleFeature;
import org.matheclipse.core.builtin.OutputFunctions.VariableManager;
import org.matheclipse.core.eval.Errors;
Expand Down Expand Up @@ -637,6 +638,7 @@ private int convertNumeric(StringBuilder parentBuffer, IExpr expression, int typ
}

} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
//
}
try {
Expand All @@ -656,7 +658,7 @@ private int convertNumeric(StringBuilder parentBuffer, IExpr expression, int typ
return 2;

} catch (RuntimeException rex) {
//
Errors.rethrowsInterruptException(rex);
}
return 0;
}
Expand All @@ -672,7 +674,7 @@ private boolean convertSymbolic(StringBuilder buf, IExpr expression) {
}));
return true;
} catch (RuntimeException rex) {
//
Errors.rethrowsInterruptException(rex);
}
return false;
}
Expand All @@ -699,6 +701,7 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
try {
result = compiledFunction.evaluate(ast, engine);
} catch (RuntimeException rex) {
Errors.rethrowsInterruptException(rex);
return Errors.printMessage(S.CompiledFunction, rex, engine);
}
if (result.isPresent()) {
Expand Down
Loading
Loading