首页 > 代码库 > 矩阵的杜利特尔分解

矩阵的杜利特尔分解

public class Main {    double a[][] = new double[][]{{2, 1, 5}, {4, 1, 12}, {-2, -4, 5}};    public static void main(String[] args) {        new Main();    }    Main() {        for (int i = 0; i < a.length; i++) {            for (int j = 0; j < a[0].length; j++) {                for (int k = 0; k < Math.min(i, j); k++) {                    a[i][j] -= a[i][k] * a[k][j];                }                if (i > j)                    a[i][j] /= a[j][j];            }        }        for (int i = 0; i < a.length; i++) {            for (int j = 0; j < a[0].length; j++) {                System.out.print(" " + a[i][j]);            }            System.out.println();        }    }}

 

矩阵的杜利特尔分解