-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix.h
More file actions
87 lines (80 loc) · 2.53 KB
/
Matrix.h
File metadata and controls
87 lines (80 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef MATRIX_H_INCLUDED
#define MATRIX_H_INCLUDED
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
using std::cout;
using std::cin;
using std::endl;
using std::setw;
class Matrix
{
private:
/// declared Matrix array pointer
double **mat_Array;
double **original;
/// declared vector;
std::vector<double> sol_Vec;
std::vector<double> b_Vec;
/// declare row, col, value
int row, col;
double value = 0;
public:
// constructor
Matrix();
// destructor
~Matrix();
// copy constructor
///Matrix(const Matrix& src);
bool CopyOriginalMatrix();
bool CopyMatrices(double **lhs, double **rhs);
// display
void Display();
void Display(double **l, double **u);
void Display(double **l, double **u, double **d);
void CurrentSolution();
// Menu
bool Menu();
// Starting Matrices
bool InputFile();
bool RandomStart();
// Save current Matrix and current vector to file called Output.txt
bool SaveData();
bool SaveSolution();
// Check Solution
bool CheckSol();
// Affect Matrices
bool GaussianElim();
bool LU_Decom();
bool BackSolve();
bool BackSolve(double **, std::vector<double>&);
bool ForwardSolve(double **, std::vector<double>&);
bool SwitchRows(int, int);
double UpdateNextRow(double, double, double);
bool DotProduct(double **, std::vector<double>&);
bool DotProduct(double **, std::vector<double>&, std::vector<double>&);
bool DotProduct(double **, int x);
bool DotProduct(double **lhs, double **rhs, double **newM);
bool AddMatrices(double **lhs, double **rhs, double **newM);
bool AddVec(std::vector<double>&, std::vector<double>&);
bool SubVec(std::vector<double>&, std::vector<double>&);
double norm(std::vector<double>& v);
double TwoNorm(std::vector<double>&);
// Iterative
// Jacobi
bool Jacobi();
bool Inverse(double **);
// Gauss Seidel
bool GaussSeidel();
// SOR
bool SOR();
// Power Method
bool PowerMethod();
bool Bisection();
bool NewthonMethod();
double f(double x);
double ff(double x);
double Fx(double x);
};
#endif // MATRIX_H_INCLUDED