19 const std::vector<EigenMatrix::IndexType>& vec_knownX_id,
20 const std::vector<double>& vec_knownX_x)
23 static_assert(SpMat::IsRowMajor,
"matrix is assumed to be row major!");
30 for (
auto row_id : vec_knownX_id)
32 for (SpMat::InnerIterator it(A_eigen, row_id); it; ++it)
34 if (it.col() !=
decltype(it.col())(row_id))
41 SpMat AT = A_eigen.transpose();
47 AT.reserve(Eigen::VectorXi::Constant(A_eigen.rows(), 1));
49 for (std::size_t ix = 0; ix < vec_knownX_id.size(); ix++)
51 SpMat::Index
const row_id = vec_knownX_id[ix];
52 auto const x = vec_knownX_x[ix];
56 for (SpMat::InnerIterator it(AT, row_id); it; ++it)
58 if (it.col() == row_id)
63 b_eigen[it.col()] -= it.value() * x;
67 auto& c = AT.coeffRef(row_id, row_id);
70 b_eigen[row_id] = x * c;
79 A_eigen = AT.transpose();
void applyKnownSolution(EigenMatrix &A, EigenVector &b, EigenVector &, const std::vector< EigenMatrix::IndexType > &vec_knownX_id, const std::vector< double > &vec_knownX_x)