207 const Eigen::MatrixBase<DerivedB>& b,
const Eigen::MatrixBase<DerivedQb>& Qb,
208 const Eigen::MatrixBase<DerivedQab>& Qab,
const Eigen::MatrixBase<DerivedQba>& Qba,
210 [[maybe_unused]]
const std::string& nameId)
216 using Eigen::seq, Eigen::last;
226 LOG_DATA(
"{}: Qa = \n{}", nameId, Eigen::MatrixXd(Qa));
227 LOG_DATA(
"{}: a = {}", nameId, a.transpose());
228 LOG_DATA(
"{}: Qb = \n{}", nameId, Eigen::MatrixXd(Qb));
229 LOG_DATA(
"{}: b = {}", nameId, b.transpose());
230 LOG_DATA(
"{}: Qab = \n{}", nameId, Eigen::MatrixXd(Qab));
231 LOG_DATA(
"{}: Qba = \n{}", nameId, Eigen::MatrixXd(Qba));
234 Eigen::VectorXd ambIntPart = a.template cast<int>().template cast<double>();
235 Eigen::VectorXd ambFracPart = a - ambIntPart;
236 LOG_DATA(
"{}: ambFracPart = {}", nameId, ambFracPart.transpose());
238 typename DerivedQa::PlainObject Qz;
239 typename DerivedQa::PlainObject Z;
240 typename DerivedQa::PlainObject L;
246 case DecorrelationAlgorithm::Z_Transformation:
249 std::tie(Qz, Z, L, D, z) = *decorrelated_ztrafo;
253 LOG_DEBUG(
"{}: Decorrelation failed", nameId);
258 case DecorrelationAlgorithm::None:
259 case DecorrelationAlgorithm::COUNT:
264 std::tie(L, D) = *ltdl_decomp;
268 LOG_DEBUG(
"{}: Decorrelation failed", nameId);
272 LOG_DATA(
"{}: z = {}", nameId, z.transpose());
273 LOG_DATA(
"{}: Qz = \n{}", nameId, Eigen::MatrixXd(Qz));
274 LOG_DATA(
"{}: Z = \n{}", nameId, Z);
275 LOG_DATA(
"{}: L = \n{}", nameId, L);
276 LOG_DATA(
"{}: D = {}", nameId, D.transpose());
295 LOG_TRACE(
"{}: Doing partial ambiguity fixing for only {} of {} ambiguities", nameId, n - k, n);
296 LOG_DATA(
"{}: z = {}", nameId, z(seq(k, last)).transpose());
297 LOG_DATA(
"{}: Qz = \n{}", nameId, Eigen::MatrixXd(Qz(seq(k, last), seq(k, last))));
298 LOG_DATA(
"{}: L = \n{}", nameId, L(seq(k, last), seq(k, last)));
299 LOG_DATA(
"{}: D = {}", nameId, D(seq(k, last)).transpose());
302 Eigen::MatrixXd cands;
303 Eigen::VectorXd sqnorm;
304 int numCandidates = 2;
308 case SearchAlgorithm::IntegerRounding:
310 sqnorm = Eigen::VectorXd::Constant(1, 1.0);
312 case SearchAlgorithm::IntegerBootstrapping:
314 sqnorm = Eigen::VectorXd::Constant(1, 1.0);
316 case SearchAlgorithm::IntegerLeastSquaresSearch:
318 L(seq(k, last), seq(k, last)), D(seq(k, last)), numCandidates);
320 case SearchAlgorithm::IntegerLeastSquaresSearchAndShrink:
323 case SearchAlgorithm::None:
324 case SearchAlgorithm::COUNT:
328#if LOG_LEVEL <= LOG_LEVEL_DATA
331 Eigen::MatrixXd print(cands.cols(), cands.rows() + 1);
332 for (Eigen::Index i = 0; i < cands.cols(); i++)
334 print(i, 0) = sqnorm(i);
335 print(i, Eigen::seq(1, Eigen::last)) = cands.col(i).transpose();
337 LOG_DATA(
"{}: sqnorm, cand (1 candidate each row)\n{}", nameId, print);
341 if (cands.cols() == 0)
343 LOG_DATA(
"{}: No candidates found ", nameId);
374 for (Eigen::Index i = 0; i < cands.cols(); i++)
379 cands.col(i) = Z.transpose().inverse() * cands.col(i);
385 cands.col(i) += ambIntPart;
388#if LOG_LEVEL <= LOG_LEVEL_DATA
390 Eigen::MatrixXd print(cands.cols(), cands.rows() + 1);
391 for (Eigen::Index i = 0; i < cands.cols(); i++)
393 print(i, 0) = sqnorm(i);
394 print(i, Eigen::seq(1, Eigen::last)) = cands.col(i).transpose();
396 LOG_DATA(
"{}: Back transformed results - sqnorm, cand (1 candidate each row){}\n{}", nameId,
397 k != 0 ?
" (not integer, because only partial fix)" :
"", print);
401 if (cands.cols() > 1)
406 case ValidationAlgorithm::DifferenceTest:
413 case ValidationAlgorithm::RatioTestCriticalValue:
420 case ValidationAlgorithm::RatioTestFailureRate:
428 case ValidationAlgorithm::ProjectorTest:
436 case ValidationAlgorithm::None:
437 case ValidationAlgorithm::COUNT:
442 result.
b = b - Qba * Qa.inverse() * (a - cands.col(0));
443 result.
Qb = Qb - Qba * Qa.inverse() * Qab;
445 for (Eigen::Index i = 0; i < cands.cols(); i++)
447 result.
fixedAmb.emplace_back(sqnorm(i), cands.col(i));
449 result.
nFixed =
static_cast<size_t>(n - k);