Improved efficiency in RandomDataImpl, LaguerreSolver, FastMath and
OutlineExtractor by moving conditional code into blocks where it is needed. JIRA: MATH-609 Reported and patched by Dave Brosius git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1145004 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
82880daefb
commit
4d02be2855
|
@ -181,10 +181,12 @@ public class LaguerreSolver extends AbstractPolynomialSolver {
|
|||
* @return {@code true} if z is a real zero.
|
||||
*/
|
||||
public boolean isRoot(double min, double max, Complex z) {
|
||||
double tolerance = FastMath.max(getRelativeAccuracy() * z.abs(), getAbsoluteAccuracy());
|
||||
return (isSequence(min, z.getReal(), max)) &&
|
||||
(FastMath.abs(z.getImaginary()) <= tolerance ||
|
||||
z.abs() <= getFunctionValueAccuracy());
|
||||
if (isSequence(min, z.getReal(), max)) {
|
||||
double tolerance = FastMath.max(getRelativeAccuracy() * z.abs(), getAbsoluteAccuracy());
|
||||
return ((FastMath.abs(z.getImaginary()) <= tolerance) ||
|
||||
(z.abs() <= getFunctionValueAccuracy()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -404,10 +404,9 @@ public class RandomDataImpl implements RandomData, Serializable {
|
|||
throw new NotStrictlyPositiveException(LocalizedFormats.MEAN, mean);
|
||||
}
|
||||
|
||||
final RandomGenerator generator = getRan();
|
||||
|
||||
final double pivot = 40.0d;
|
||||
if (mean < pivot) {
|
||||
final RandomGenerator generator = getRan();
|
||||
double p = FastMath.exp(-mean);
|
||||
long n = 0;
|
||||
double r = 1.0d;
|
||||
|
|
|
@ -1489,8 +1489,6 @@ public class FastMath {
|
|||
* @return log(1 + x)
|
||||
*/
|
||||
public static double log1p(final double x) {
|
||||
double xpa = 1.0 + x;
|
||||
double xpb = -(xpa - 1.0 - x);
|
||||
|
||||
if (x == -1) {
|
||||
return x/0.0; // -Infinity
|
||||
|
@ -1501,6 +1499,9 @@ public class FastMath {
|
|||
}
|
||||
|
||||
if (x>1e-6 || x<-1e-6) {
|
||||
double xpa = 1.0 + x;
|
||||
double xpb = -(xpa - 1.0 - x);
|
||||
|
||||
double hiPrec[] = new double[2];
|
||||
|
||||
final double lores = log(xpa, hiPrec);
|
||||
|
|
|
@ -52,6 +52,10 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
If the output is not quite correct, check for invisible trailing spaces!
|
||||
-->
|
||||
<release version="3.0" date="TBD" description="TBD">
|
||||
<action dev="psteitz" type="update" issue="MATH-609" due-to="Dave Brosius">
|
||||
Improved efficiency in RandomDataImpl, LaguerreSolver, FastMath and OutlineExtractor by
|
||||
moving conditional code into blocks where it is needed.
|
||||
</action>
|
||||
<action dev="luc" type="fix" issue="MATH-603" due-to="Dennis Hendriks">
|
||||
Prevent step normalizer to output twice the last point in MULTIPLES mode.
|
||||
</action>
|
||||
|
|
Loading…
Reference in New Issue