# 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:

*A*_{1}*x*=*b*_{1}*A*_{2}*x*=*b*_{2}

where *A*_{1}, *A*_{2} ∈ ℝ^{n,n} and *b*_{1}, *b*_{2} ∈ ℝ^{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
*A*_{1}, *A*_{2}, *b*_{1} and *b*_{2}, taking into account that *A*_{1} and *A*_{2} 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 time`fptype`

to`double`

or`float`

- optimal and non-optimal versions by defining or not preprocessor macro
`OPTIMIZED`

(see Makefile).