40 Eigen::Matrix<double,Eigen::Dynamic,1>
b(Eigen::Matrix<double,Eigen::Dynamic,1>::Zero(
NP.first.cols(),1));
41 Eigen::Matrix<double,Eigen::Dynamic,1> b1(Eigen::Matrix<double,Eigen::Dynamic,1>::Zero(
NP.first.cols(),1));
42 for(
int k=0;
k<
NP.first.cols();++
k)
44 b(
k)=
NP.first.col(
k).dot(
x-
NP.second.col(
k));
45 b1(
k)=
NP.first.col(
k).dot(
NP.second.col(
k));
48 const int r(
svd.rank());
49 const Eigen::MatrixXd Vr(
svd.matrixV().block(0,0,
NP.first.cols(),r));
50 const Eigen::VectorXd Sinv2(
svd.singularValues().segment(0,r).array().pow(-2).matrix());
51 const Eigen::VectorXd lam(Vr*Sinv2.asDiagonal()*Vr.transpose()*
b);
54 const double b1norm2(b1.squaredNorm());
55 if(b1norm2>
svd.threshold())
57 if((
NP.first.transpose()*
y-b1).squaredNorm()/b1norm2<
svd.threshold())
59 return std::make_pair(
true,
y);
63 return std::make_pair(
false,
y);
68 if((
NP.first.transpose()*
y-b1).squaredNorm()<
svd.threshold())
70 return std::make_pair(
true,
y);
74 return std::make_pair(
false,
y);