34 for (std::vector<double>& subvec :
Diis_Bs_) {
35 subvec.erase(subvec.begin() + maxerrorindex);
41 std::vector<double> Bijs;
45 Bijs.push_back(value);
48 Bijs.push_back(errormatrix.cwiseProduct(errormatrix.transpose()).sum());
58 Eigen::MatrixXd B = Eigen::MatrixXd::Zero(size, size);
60 for (
Index i = 0; i < B.rows(); i++) {
61 for (
Index j = 0; j <= i; j++) {
68 Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> es(B);
69 Eigen::MatrixXd eigenvectors = Eigen::MatrixXd::Zero(size, size);
71 for (
Index i = 0; i < es.eigenvectors().cols(); i++) {
72 double norm = es.eigenvectors().col(i).sum();
73 eigenvectors.col(i) = es.eigenvectors().col(i) / norm;
77 Eigen::VectorXd errors =
78 (eigenvectors.transpose() * B * eigenvectors).diagonal().cwiseAbs();
80 double MaxWeight = 10.0;
83 for (
Index i = 0; i < errors.size(); i++) {
84 errors.minCoeff(&mincoeff);
85 if (std::abs(eigenvectors.col(mincoeff).maxCoeff()) > MaxWeight) {
86 errors[mincoeff] = std::numeric_limits<double>::max();
93 Eigen::VectorXd coeffs = eigenvectors.col(mincoeff);
95 if (std::abs(coeffs[coeffs.size() - 1]) < 0.001) {