1#ifndef _MathMatrixClass_H_
2#define _MathMatrixClass_H_
10#include <unordered_map>
16 using VectorDouble = std::vector<double>;
17 using pVectorDouble = std::vector<double*>;
19 using Matrix = std::vector<VectorDouble>;
20 using pMatrix = std::vector<pVectorDouble>;
22 using VectorIndex = std::vector<size_t>;
23 using pVectorIndex = std::vector<size_t*>;
25 using BipartiteGraph = std::unordered_map<std::string, std::set<std::string>>;
27 pMatrix *pA =
nullptr;
28 pVectorDouble *pB =
nullptr;
29 pVectorDouble *pSolution =
nullptr;
30 pVectorIndex *pSolutionBeloneNetlistIndex =
nullptr;
32 MathMatrixClass(Matrix* , VectorDouble* , VectorDouble* , VectorIndex* );
36 void showDescription();
38 void solveBigQuestion();
44 void copyMatrix(Matrix*, pMatrix*);
45 void copyVectorDouble(VectorDouble*, pVectorDouble*);
46 void copyVectorIndex(VectorIndex*, pVectorIndex*);
48 void copyMatrix(pMatrix*, pMatrix*,
const VectorIndex&,
const VectorIndex&);
49 void copyVectorDouble(pVectorDouble*, pVectorDouble*,
const VectorIndex&);
50 void copyVectorIndex(pVectorIndex*, pVectorIndex*,
const VectorIndex&);
52 void printMatrix(
const pMatrix* );
53 void printVector(
const pVectorDouble* );
54 void printVector(
const pVectorIndex* );
57 std::list<MathMatrixClass*> splitToMultiSubQuestions();
59 BipartiteGraph buildBipartiteGraph();
60 void dfs(
const std::string& , BipartiteGraph& , std::set<std::string>& , std::vector<std::string>& );
63 bool isSingularMatrix();
64 bool isSquareMatrix();
65 double determinant(
const Matrix& matrix);
67 bool solveLinearSystem();
69 void luDecomposition( Matrix& , Matrix& );
71 VectorDouble forwardSubstitution(
const Matrix& );
73 VectorDouble backwardSubstitution(
const Matrix& ,
const VectorDouble&);
Definition: MathMatrixClass.h:14