package com.imsl.test.example.math; import com.imsl.math.*; /** *

Solves a system using Cholesky factorization.

* * This example uses the Cholesky factorization of \(A\) to solve \(Ax=b\) * and to find the inverse, \( A^{-1}\). * * @see Code * @see Output */ public class CholeskyEx1 { public static void main(String args[]) throws com.imsl.IMSLException { double a[][] = { {1, -3, 2}, {-3, 10, -5}, {2, -5, 6} }; double b[] = {27, -78, 64}; // Compute the Cholesky factorization of A Cholesky cholesky = new Cholesky(a); // Solve Ax = b double x[] = cholesky.solve(b); new PrintMatrix("x").print(x); // Find the inverse of A. double ainv[][] = cholesky.inverse(); new PrintMatrix("ainv").print(ainv); } }