Master Degree (Artificial Intelligence)
Course: Computational Mathematics for Learning and Data Analysis
Academic Year: 2022/2023
University of Pisa, Italy 🇮🇹
(P) is a sparse linear system of the form
where
(A1) is GMRES, and you must solve the internal problems
(A2) is the same GMRES, but using the so-called Schur complement preconditioner
where
No off-the-shelf solvers allowed.
In order to use the algorithm, you need to call the function our_gmres
in the following way:
[x, r_rel, residuals, break_flag, k] = our_gmres(D, E, S, b, starting_point, threshold, reorth_flag, debug)
Input: D - the original diagonal vector
E - the original E matrix
S - the (optional) Shur complement matrix factorized with the Incomplete Cholesky factorization
- set to NaN if preconditioning is not required
b - the original b vector
starting_point - the starting point of the algorithm
threshold - the threshold to stop the algorithm
reorth_flag - the flag is used to decide if the reorthogonalization is needed
debug - the (optional) flag is used to print the debug information - set to NaN if not used
Output: x - the solution of the system
r_rel - the relative residual
residuals - the vector of the residuals
break_flag - the flag that indicates the reason why the algorithm stopped
0 - the algorithm converged at the threshold
1 - the algorithm converged due to the patient
2 - the algorithm converged due to the lucky breakdown
-1 - the algorithm did not converge
k - the number of iterations
To check the correctness and the performance of the algorithm, a suite of tests is provided. In order to run the tests, you need to call the function run_everything
in the following way:
test/run_everything.m
The results (.csv and plots) of the tests are stored in their corresponding folders.
To explore a specific case, execute the main.m file and utilize the prompt to select the parameters.
📦
┣ 📂 graphs
┣ 📂 test
┣ 📂 A1_test
┣ 📂 A2_test
┗ 📜 run_everything.m - run all the tests
┣ 📜 our_gmres.m - our implementation of GMRES
┗ 📜 main.m