elimination added
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "elimination.h"
|
||||
#include "matrix.h"
|
||||
#include "math.h"
|
||||
|
||||
Matrix createGeneralMatrix(Matrix& A, ColumnVector& C, ColumnVector& b) {
|
||||
Matrix generalMatrix(A.getRows() + 1, A.getColumns() + 1);
|
||||
for (int i = 0; i < A.getColumns(); i++) {
|
||||
generalMatrix[0][i] = C[i];
|
||||
}
|
||||
|
||||
generalMatrix[0][A.getColumns()] = 0;
|
||||
for (int j = 0; j < A.getRows(); j++) {
|
||||
generalMatrix[j + 1][A.getColumns()] = b[j];
|
||||
}
|
||||
|
||||
for (int i = 0; i < A.getRows(); i++) {
|
||||
for (int j = 0; j < A.getColumns(); j++) {
|
||||
generalMatrix[i + 1][j] = A[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
return generalMatrix;
|
||||
}
|
||||
|
||||
Matrix elimination(Matrix A, ColumnVector C, ColumnVector b, int pivot_column_index, int pivot_row_index, double eps) {
|
||||
Matrix generalMatrix = createGeneralMatrix(A, C, b);
|
||||
|
||||
|
||||
return generalMatrix;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef ELIMINATION_H
|
||||
#define ELIMINATION_H
|
||||
|
||||
|
||||
|
||||
class Elimination {
|
||||
public:
|
||||
Matrix elimination(Matrix A, ColumnVector C, ColumnVector b, int pivot_column_index, int pivot_row_index, double eps);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //ELIMINATION_H
|
||||
@@ -1 +0,0 @@
|
||||
#include "gauss_jordan.h"
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef GAUSS_JORDAN_H
|
||||
#define GAUSS_JORDAN_H
|
||||
|
||||
|
||||
|
||||
class gauss_jordan {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //GAUSS_JORDAN_H
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
class ColumnVector;
|
||||
class Matrix;
|
||||
|
||||
class Math {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user