import org.apache.commons.math3.linear.*; public class LinearAlgebraExample { public static void main(String[] args) { double[][] matrixData = { {1,2,3}, {4,5,6}, {7,8,9} }; RealMatrix matrix = MatrixUtils.createRealMatrix(matrixData); DecompositionSolver solver = new LUDecomposition(matrix).getSolver(); RealVector constants = new ArrayRealVector(new double[]{1, 2, 3}, false); RealVector solution = solver.solve(constants); System.out.println("Solution: " + solution); } }


上一篇:
下一篇:
切换中文