aboutsummaryrefslogtreecommitdiff
path: root/distortionobserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'distortionobserver.cpp')
-rw-r--r--distortionobserver.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/distortionobserver.cpp b/distortionobserver.cpp
new file mode 100644
index 0000000..a6c5ba4
--- /dev/null
+++ b/distortionobserver.cpp
@@ -0,0 +1,27 @@
+#include "distortionobserver.h"
+
+#include "mp.h"
+
+DistortionObserver::DistortionObserver(const arma::mat &X,
+ const arma::uvec &sampleIndices)
+ : m_X(X)
+ , m_sampleIndices(sampleIndices)
+{
+ m_distX = mp::dist(m_X);
+}
+
+DistortionObserver::~DistortionObserver()
+{
+}
+
+void DistortionObserver::setMap(const arma::mat &Y)
+{
+ arma::vec measures = measureFunc(m_distX, mp::dist(Y));
+
+ if (m_Y.n_elem != 0) {
+ emit mapChanged(measures - m_measures);
+ } else {
+ m_Y = Y;
+ m_measures = measures;
+ }
+}