Utility functions for matrix initialization and display.
More...
#include <vector>
#include <string>
#include <chrono>
Go to the source code of this file.
|
bool | InitMatrix (std::vector< std::vector< double > > &m, const std::string &filename, int &rows, int &cols) |
| Initializes the matrix by reading from a .in file.
|
|
void | ShowEquations (const std::vector< std::vector< double > > &m, int rows, int cols) |
| Displays the system of linear equations.
|
|
bool | CheckConsistency (const std::vector< std::vector< double > > &m, int rows, int cols) |
| Checks the consistency of the system of equations.
|
|
void | DisplaySolution (const std::vector< double > &solution) |
| Displays the unique solution.
|
|
std::chrono::steady_clock::time_point | StartTimer () |
|
void | StopTimer (const std::chrono::steady_clock::time_point &start) |
|
Utility functions for matrix initialization and display.
- Author
- Gilbert Young
- Date
- 2024/09/25
Definition in file utils.h.
◆ CheckConsistency()
bool CheckConsistency |
( |
const std::vector< std::vector< double > > & | m, |
|
|
int | rows, |
|
|
int | cols ) |
Checks the consistency of the system of equations.
- Parameters
-
m | The matrix representing the system. |
rows | Number of rows in the matrix. |
cols | Number of columns in the matrix. |
- Returns
- true If the system is consistent.
-
false If the system is inconsistent.
◆ DisplaySolution()
void DisplaySolution |
( |
const std::vector< double > & | solution | ) |
|
Displays the unique solution.
- Parameters
-
solution | The solution vector. |
◆ InitMatrix()
bool InitMatrix |
( |
std::vector< std::vector< double > > & | m, |
|
|
const std::string & | filename, |
|
|
int & | rows, |
|
|
int & | cols ) |
Initializes the matrix by reading from a .in
file.
- Parameters
-
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. |
- Returns
- true If the matrix was successfully initialized.
-
false If there was an error during initialization.
◆ ShowEquations()
void ShowEquations |
( |
const std::vector< std::vector< double > > & | m, |
|
|
int | rows, |
|
|
int | cols ) |
Displays the system of linear equations.
- Parameters
-
m | The matrix representing the system. |
rows | Number of equations. |
cols | Number of variables plus one (for constants). |
◆ StartTimer()
std::chrono::steady_clock::time_point StartTimer |
( |
| ) |
|
Definition at line 157 of file utils.cpp.
158{
159 return chrono::steady_clock::now();
160}
◆ StopTimer()
void StopTimer |
( |
const std::chrono::steady_clock::time_point & | start | ) |
|