From 69ac2d5c82d6b93591cd9eb5c22d1cca58b3e9fd Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Wed, 6 Apr 2016 18:32:11 +0100 Subject: [PATCH] FitInterface: test functions for correlations --- lib/FitInterface.cpp | 33 +++++++++++++++++++++++++++++++++ lib/FitInterface.hpp | 7 +++++++ 2 files changed, 40 insertions(+) diff --git a/lib/FitInterface.cpp b/lib/FitInterface.cpp index ac7721c..02b9e31 100644 --- a/lib/FitInterface.cpp +++ b/lib/FitInterface.cpp @@ -411,6 +411,39 @@ bool FitInterface::isFitPoint(const Index k, const Index j) const return yDataIndex_[j].at(k); } +bool FitInterface::isXXCorrelated(const Index r1, const Index i1, + const Index r2, const Index i2) const +{ + array c{{r1, i1, r2, i2}}; + auto it = xxCorr_.find(c); + + return (it != xxCorr_.end()); +} + +bool FitInterface::isYYCorrelated(const Index k1, const Index j1, + const Index k2, const Index j2) const +{ + array c{{k1, j1, k2, j2}}; + auto it = yyCorr_.find(c); + + return (it != yyCorr_.end()); +} + +bool FitInterface::isXYCorrelated(const Index r, const Index i, + const Index k, const Index j) const +{ + array c{{r, i, k, j}}; + auto it = xyCorr_.find(c); + + return (it != xyCorr_.end()); +} + +bool FitInterface::hasCorrelations(void) const +{ + return ((xxCorr_.size() != 0) or (yyCorr_.size() != 0) + or (xyCorr_.size() != 0)); +} + // make correlation filter for fit variance matrix ///////////////////////////// DMat FitInterface::makeCorrFilter(void) { diff --git a/lib/FitInterface.hpp b/lib/FitInterface.hpp index b23924a..21c45f3 100644 --- a/lib/FitInterface.hpp +++ b/lib/FitInterface.hpp @@ -108,6 +108,13 @@ public: bool isXExact(const Index i) const; bool isXUsed(const Index r, const Index i, const bool inFit = true) const; bool isFitPoint(const Index k, const Index j) const; + bool isXXCorrelated(const Index r1, const Index i1, const Index r2, + const Index i2) const; + bool isYYCorrelated(const Index k1, const Index j1, const Index k2, + const Index j2) const; + bool isXYCorrelated(const Index r, const Index i, const Index k, + const Index j) const; + bool hasCorrelations(void) const; // make correlation filter for fit variance matrix DMat makeCorrFilter(void); // schedule variance matrix initialization