You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/07/15 16:28:56 UTC

[commons-math] branch master updated (f54b4c7c9 -> 0bf33a4fc)

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git


    from f54b4c7c9 Migrate workflows from adopt to temurin
     new 64e281892 Use complex multiply by scalar
     new 0bf33a4fc Use Complex.ZERO.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


[commons-math] 02/02: Use Complex.ZERO.

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 0bf33a4fc13474835414a24c80d50cc7710eaf49
Author: aherbert <ah...@apache.org>
AuthorDate: Fri Jul 15 17:28:33 2022 +0100

    Use Complex.ZERO.
    
    This does not change the equals comparison. Note that this will not
    detect sign differences, e.g. (0.0, 0.0) == (-0.0, 0.0) and a tolerance
    may be required for more robustness.
---
 .../apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java
index e0dcc37b7..24afe0b7f 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java
@@ -368,7 +368,8 @@ public class LaguerreSolver extends AbstractPolynomialSolver {
                 final Complex denominator = dplus.abs() > dminus.abs() ? dplus : dminus;
                 // Perturb z if denominator is zero, for instance,
                 // p(x) = x^3 + 1, z = 0.
-                if (denominator.equals(Complex.ofCartesian(0.0, 0.0))) {
+                // This uses exact equality to zero. A tolerance may be required here.
+                if (denominator.equals(Complex.ZERO)) {
                     z = z.add(Complex.ofCartesian(absoluteAccuracy, absoluteAccuracy));
                     oldz = Complex.ofCartesian(Double.POSITIVE_INFINITY,
                                        Double.POSITIVE_INFINITY);


[commons-math] 01/02: Use complex multiply by scalar

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 64e28189243d1ee4568b84dc2bfeff67350da3e9
Author: aherbert <ah...@apache.org>
AuthorDate: Fri Jul 15 17:17:40 2022 +0100

    Use complex multiply by scalar
---
 .../apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java
index c6cc839aa..e0dcc37b7 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/solvers/LaguerreSolver.java
@@ -344,7 +344,7 @@ public class LaguerreSolver extends AbstractPolynomialSolver {
                     dv = pv.add(z.multiply(dv));
                     pv = coefficients[j].add(z.multiply(pv));
                 }
-                d2v = d2v.multiply(Complex.ofCartesian(2.0, 0.0));
+                d2v = d2v.multiply(2);
 
                 // Check for convergence.
                 final double tolerance = JdkMath.max(relativeAccuracy * z.abs(),