This is a C program that solves a system of linear equations using Gaussian Elimination. Work carried out as part of the numerical algorithms discipline.
This program implements the Gaussian Elimination algorithm to solve a system of linear equations in the form of Ax = b
, where A is a square matrix, x is the solution vector, and b is the right-hand side vector.
- Create an input file containing the linear system you want to solve.
- Run the program, passing the input file as a command-line argument.
./gausianElimination linearSystem.dat
The input file should follow the format described below:
- The first line should contain a single integer n, representing the dimension of the square matrix A.
- The next n lines should contain n space-separated values, representing the elements of the matrix A.
- The final line should contain n space-separated values, representing the elements of the vector b.
Example input file:
3
5.0 2.0 1.0
2.0 -1.0 3.0
0.0 1.0 -2.0
8.0 9.0 -6.0
The file above represents the following linear system:
Use make to compile the program:
make release
It is also possible to generate a debug version that better describes the steps performed:
make debug