sum implementation

This commit is contained in:
Damian Kowalski 2024-04-07 13:46:53 +02:00
parent 3fc16dbe8e
commit a36a7c115c

View File

@ -71,8 +71,11 @@ const math::matrix<float> Convolution::join(math::matrix<float> A, math::matrix<
const float Convolution::sum(const math::matrix<float> A) const float Convolution::sum(const math::matrix<float> A)
{ {
float sum = 0.0; 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; return sum;
@ -85,8 +88,8 @@ const math::matrix<float> Convolution::reflection(const math::matrix<float> A)
int size = A.rowno(); int size = A.rowno();
math::matrix<float> C(size, size); math::matrix<float> C(size, size);
for (int i=0; i < size; i++) for (int i = 0; i < size; i++)
for (int j=0; j < size; j++) for (int j = 0; j < size; j++)
C[i][j] = A[size-i-1][size-j-1]; C[i][j] = A[size-i-1][size-j-1];
return C; return C;