Steepest Descent and Conjugate Gradients methods
About
In this project, the Steepest Descent and Conjugate Gradients methods were implemented for solving the following linear systems:
- A1x = b1
- A2x = b2
where A1, A2 ∈ ℝn,n and b1, b2 ∈ ℝn:
In the context of this exercise, double-precision floating-point arithmetic was used in order to compare the two linear systems in terms of convergence speed and the number of iterations required, as n takes value in {100, 1000, 10000}. Moreover, provided that r(k) is the residual vector at the k-th step, the maximum residual should be ||r(k)|| ≤ 0.5 * 10-4.
The purpose of this project was also to achieve the minimum time complexity for this specific form of input matrices A1, A2, b1 and b2, taking into account that A1 and A2 are pentadiagonal matrices.
Implementation details
The project was implemented in C language.
The C language version supports:
- single and double-precision floating-point arithmetic by
typedef
ing each timefptype
todouble
orfloat
- optimal and non-optimal versions by defining or not preprocessor macro
OPTIMIZED
(see Makefile).