From 41db4c276373aa39273343cfac96529126f4cefd Mon Sep 17 00:00:00 2001
From: Jakhes <dean.schmitz@schmitzbauer.de>
Date: Mon, 7 Nov 2022 23:49:18 +0100
Subject: [PATCH] Finishing nca tests

---
 src/methods/nca/nca.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/methods/nca/nca.cpp b/src/methods/nca/nca.cpp
index f6b0ba2..5a25c64 100644
--- a/src/methods/nca/nca.cpp
+++ b/src/methods/nca/nca.cpp
@@ -37,7 +37,13 @@ void nca(	char const *optimizerType,
 {	
 	// convert the Prolog array to arma::mat
 	mat data = convertArrayToMat(dataMatArr, dataMatSize, dataMatRowNum);
-	
+	// check if labels fit the data
+    if (data.n_cols != rawLabelsArrSize)
+    {
+        raisePrologSystemExeption("The number of data points does not match the number of labels!");
+        return;
+    }
+
 	// convert the Prolog array to arma::rowvec
 	Row< size_t > rawLabels = convertArrayToVec(rawLabelsArr, rawLabelsArrSize);
 
-- 
GitLab