| 105 | } |
| 106 | |
| 107 | pair<MatrixXd, vector<int>> getSubMatrix(const vector<int>& Sp, SparseQMatrix<double>& Ae) { |
| 108 | int size = Sp.size(); |
| 109 | //cout << "size=" << size << endl; |
| 110 | //sort(Sp.begin(), Sp.end()); |
| 111 | int cols = Ae.size; |
| 112 | MatrixXd subA(size, cols); |
| 113 | for (int i = 0; i < size; i++) |
| 114 | { |
| 115 | subA.row(i) = Ae.getSparseEigenRowVector(Sp[i]); |
| 116 | } |
| 117 | |
| 118 | vector<int> NoZeroIndex; |
| 119 | for (int j = 0; j < cols; j++) { |
| 120 | VectorXd col_i = subA.col(j); |
| 121 | bool NoneZero = JudgeNoneZero(col_i); |
| 122 | if (NoneZero) { |
| 123 | NoZeroIndex.push_back(j); |
| 124 | } |
| 125 | } |
| 126 | int NoneZeroSize = NoZeroIndex.size(); |
| 127 | MatrixXd No0subA(size, NoneZeroSize); |
| 128 | for (int i = 0; i < NoneZeroSize; i++) { |
| 129 | No0subA.col(i) = subA.col(NoZeroIndex[i]); |
| 130 | } |
| 131 | return make_pair(No0subA, NoZeroIndex); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | VectorXd getb(int index, const vector<int>& No0Ind) { |
no test coverage detected