Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. public static void choleskyFactorization(double[][] A, double[][] L) {
  2.  
  3. int n = A.length;
  4. for (int i = 0; i < n; i++) {
  5. for (int j = 0; j <= i; j++) {
  6. double sum = 0.0;
  7. for (int k = 0; k < j; k++) {
  8. sum += L[i][k] * L[j][k];
  9. }
  10. if (i == j)
  11. L[i][i] = Math.sqrt(A[i][i] - sum);
  12. else
  13. L[i][j] = 1.0 / L[j][j] * (A[i][j] - sum);
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement