我正在尝试使用 ejml 库对矩阵进行 LU 分解。SVD分解的计算一切顺利,对于LU分解我不知道使用ejml库。我需要你的帮助
import java.util.Scanner;
import org.ejml.alg.dense.decomposition.CholeskyDecomposition;
import org.ejml.alg.dense.decomposition.DecompositionFactory;
import org.ejml.alg.dense.decomposition.DecompositionInterface;
import org.ejml.alg.dense.decomposition.LUDecomposition;
import org.ejml.alg.dense.decomposition.lu.*;
import org.ejml.data.DenseMatrix64F;
import org.ejml.simple.SimpleMatrix;
import org.ejml.simple.SimpleSVD;
public class autovalori {
public static void main(String[] args) {
double[][] matrix;
double[] u;
int r, c, t = 0;
Scanner scanner = new Scanner(System.in);
System.out.println("Insert row matrix: ");
r = scanner.nextInt();//row matrix
System.out.println("Insert columns matrix: ");
c = scanner.nextInt(); //columns matrix
matrix = new double[r][c];
for (int i = 0; i < r; i++){
for (int j = 0; j < c; j++){
System.out.printf("value: " + i + " - " + j);
System.out.printf("\n");
matrix[i][j] = scanner.nextDouble();
}
}
System.out.printf("\n");
SimpleMatrix A = new SimpleMatrix(matrix);
SimpleSVD SVD = A.svd();
SimpleMatrix U = SVD.getU();
SimpleMatrix S = SVD.getV();
SimpleMatrix V = SVD.getW();
U.print();
S.print();
V.print();