From a36a7c115cf2888801eda7e044256a5bedd74b00 Mon Sep 17 00:00:00 2001 From: Damian Kowalski Date: Sun, 7 Apr 2024 13:46:53 +0200 Subject: [PATCH] sum implementation --- src/core/transformations/convolution.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/transformations/convolution.cpp b/src/core/transformations/convolution.cpp index a02b3b9..72be966 100644 --- a/src/core/transformations/convolution.cpp +++ b/src/core/transformations/convolution.cpp @@ -71,8 +71,11 @@ const math::matrix Convolution::join(math::matrix A, math::matrix< const float Convolution::sum(const math::matrix A) { float sum = 0.0; + int size = A.rowno(); - qDebug() << Q_FUNC_INFO << "Not implemented yet!"; + for (int i = 0; i< size; i++) + for (int j = 0; j< size; j++) + sum = sum + A[i][j]; return sum; @@ -85,8 +88,8 @@ const math::matrix Convolution::reflection(const math::matrix A) int size = A.rowno(); math::matrix C(size, size); - for (int i=0; i < size; i++) - for (int j=0; j < size; j++) + for (int i = 0; i < size; i++) + for (int j = 0; j < size; j++) C[i][j] = A[size-i-1][size-j-1]; return C;