Chore/replace ejml with ojalgo - #2263
Open
asmfstatoil wants to merge 19 commits into
Open
Conversation
asmfstatoil
force-pushed
the
chore/replace-ejml-with-ojalgo
branch
from
June 7, 2026 20:33
7123f59 to
47306d5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces EJML with ojAlgo as the primary linear algebra backend across flash operations, process equipment solvers, and related tests, updating Maven dependencies accordingly.
Changes:
- Swap Maven dependency from
org.ejml:ejml-alltoorg.ojalgo:ojalgo(incl. Java 8 pom). - Migrate several linear algebra implementations in thermo/process codepaths (LU, SVD, eigen) from EJML to ojAlgo / Commons Math.
- Add JUnit tagging (
@Tag("LinearAlgebra")) to group solver/benchmark tests affected by the dependency change.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/neqsim/thermodynamicoperations/util/example/CriticalPointFlashTest.java | Adds LinearAlgebra tag; introduces trailing blank lines at EOF. |
| src/test/java/neqsim/thermodynamicoperations/flashops/TPmultiflashTest.java | Tags test class for linear algebra grouping. |
| src/test/java/neqsim/thermodynamicoperations/flashops/NewtonSolverAnalysisTest.java | Replaces EJML benchmarking code with ojAlgo equivalents; adds LinearAlgebra tag. |
| src/test/java/neqsim/thermo/phase/GaussianEliminationTest.java | Replaces EJML inversion/solve comparisons with ojAlgo LU-based reference. |
| src/test/java/neqsim/process/equipment/reactor/GibbsReactorAlgorithmTest.java | Tags tests; minor formatting cleanup. |
| src/test/java/neqsim/process/equipment/network/PipelineNetworkDocExamplesTest.java | Tags doc-compilation test for linear algebra grouping. |
| src/test/java/neqsim/process/equipment/network/NetworkLinearSolverTest.java | Tags network solver test for linear algebra grouping. |
| src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash.java | Replaces EJML-based solves/determinant/pinv with ojAlgo LU/SVD and primitive-array helpers. |
| src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflash.java | Migrates the preallocated Newton solve loop from EJML to ojAlgo LU. |
| src/main/java/neqsim/thermodynamicoperations/flashops/CriticalPointFlash.java | Replaces EJML eigen decomposition with ojAlgo eigen solver and array-based quadratic form. |
| src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java | Removes EJML imports and introduces an in-file EJML-compat shim backed by ojAlgo. |
| src/main/java/neqsim/thermo/phase/PhaseSrkCPAs.java | Removes leftover EJML-related commented imports. |
| src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java | Removes EJML imports and introduces an in-file EJML-compat shim backed by ojAlgo (incl. invert). |
| src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java | Removes EJML imports and introduces an in-file EJML-compat shim backed by ojAlgo. |
| src/main/java/neqsim/process/util/reconciliation/DataReconciliationEngine.java | Replaces EJML SimpleMatrix usage with ojAlgo stores and LU-based solve helper. |
| src/main/java/neqsim/process/equipment/reactor/GibbsReactor.java | Replaces EJML matrix operations with ojAlgo (LU/SVD/invert/pinv) and helper conversion methods. |
| src/main/java/neqsim/process/equipment/network/NetworkLinearSolver.java | Migrates dense solver path from EJML to ojAlgo; “sparse” path now dispatches to dense backend. |
| src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/GTSurfaceTensionODE.java | Replaces EJML SVD/nullspace + LU solves with Apache Commons Math linear algebra. |
| pomJava8.xml | Swaps EJML dependency for ojAlgo in Java 8 build pom. |
| pom.xml | Swaps EJML dependency for ojAlgo in main build pom. |
| .github/workflows/publish_to_maven_central.yml | Removes workflow step that cleared EJML from Maven cache. |
| .github/copilot-instructions.md | Updates dependency description text from EJML to ojAlgo (spelling/casing adjusted). |
Comment on lines
+395
to
+402
| private void solveLinear(double[][] matrix, double[] rhs, double[] result) { | ||
| RealMatrix a = new Array2DRowRealMatrix(matrix, false); | ||
| DecompositionSolver solver = new LUDecomposition(a).getSolver(); | ||
| RealVector x = solver.solve(new ArrayRealVector(rhs, false)); | ||
| for (int i = 0; i < result.length; i++) { | ||
| result[i] = x.getEntry(i); | ||
| } | ||
| } |
asmfstatoil
force-pushed
the
chore/replace-ejml-with-ojalgo
branch
from
June 8, 2026 07:01
516b89b to
2d53361
Compare
Comment on lines
+1820
to
+1831
| private double conditionP2(double[][] matrix) { | ||
| Primitive64Store matrixStore = toStore(matrix); | ||
| SingularValue<Double> svd = SingularValue.PRIMITIVE.make(matrixStore); | ||
| if (!svd.decompose(matrixStore)) { | ||
| return Double.POSITIVE_INFINITY; | ||
| } | ||
| double maxSingular = svd.getOperatorNorm(); | ||
| double minSingular = svd.getFrobeniusNorm() / Math.max(1.0, svd.getRank()); | ||
| if (Math.abs(minSingular) < 1.0e-30) { | ||
| return Double.POSITIVE_INFINITY; | ||
| } | ||
| return maxSingular / minSingular; |
asmfstatoil
force-pushed
the
chore/replace-ejml-with-ojalgo
branch
from
June 8, 2026 18:51
5bc33f4 to
54e86f1
Compare
asmfstatoil
force-pushed
the
chore/replace-ejml-with-ojalgo
branch
2 times, most recently
from
June 22, 2026 07:35
35a556c to
dfdda8d
Compare
asmfstatoil
force-pushed
the
chore/replace-ejml-with-ojalgo
branch
from
June 22, 2026 07:43
dfdda8d to
6620661
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
asmfstatoil
force-pushed
the
chore/replace-ejml-with-ojalgo
branch
from
June 22, 2026 22:29
6620661 to
3e570c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Thank you for contributing to NeqSim! Please complete the following checklist before requesting review:
./mvnw testruns successfullySee CONTRIBUTING.md for the full contribution process.