Linear Equations Solver
1.0
Using Gaussian elimination
|
Implementation of utility functions for matrix operations. More...
#include "utils.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include <iomanip>
Go to the source code of this file.
Functions | |
bool | InitMatrix (vector< vector< double > > &m, const string &filename, int &rows, int &cols) |
Initializes the matrix by reading from a .in file. | |
void | ShowEquations (const vector< vector< double > > &m, int rows, int cols) |
Displays the system of linear equations. | |
bool | CheckConsistency (const vector< vector< double > > &m, int rows, int cols) |
Checks the consistency of the system of equations. | |
void | DisplaySolution (const vector< double > &solution) |
Displays the unique solution. | |
chrono::steady_clock::time_point | StartTimer () |
void | StopTimer (const chrono::steady_clock::time_point &start) |
Implementation of utility functions for matrix operations.
This file contains the implementations of functions that handle reading matrices from .in
files and displaying the corresponding system of linear equations. These utility functions are essential for the initialization and output of matrix data used in solving linear systems.
Definition in file utils.cpp.
bool CheckConsistency | ( | const vector< vector< double > > & | m, |
int | rows, | ||
int | cols ) |
Checks the consistency of the system of equations.
m | The matrix representing the system. |
rows | Number of rows in the matrix. |
cols | Number of columns in the matrix. |
Definition at line 123 of file utils.cpp.
void DisplaySolution | ( | const vector< double > & | solution | ) |
Displays the unique solution.
solution | The solution vector. |
Definition at line 147 of file utils.cpp.
bool InitMatrix | ( | vector< vector< double > > & | m, |
const string & | filename, | ||
int & | rows, | ||
int & | cols ) |
Initializes the matrix by reading from a .in
file.
m | Reference to the matrix to be initialized. |
filename | Name of the input file. |
rows | Reference to store the number of rows. |
cols | Reference to store the number of columns. |
Definition at line 24 of file utils.cpp.
void ShowEquations | ( | const vector< vector< double > > & | m, |
int | rows, | ||
int | cols ) |
Displays the system of linear equations.
m | The matrix representing the system. |
rows | Number of equations. |
cols | Number of variables plus one (for constants). |
Definition at line 78 of file utils.cpp.
chrono::steady_clock::time_point StartTimer | ( | ) |