From 238c872753625d12411a3db8fd5f497a2f1bd565 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 6 Oct 2018 19:48:13 +0200 Subject: [PATCH] GENERIC_2D_ARRAY: Pass parameters by reference This fixes warnings from LGTM: This parameter of type FontClassInfo is 192 bytes - consider passing a pointer/reference instead. Signed-off-by: Stefan Weil --- src/ccstruct/matrix.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ccstruct/matrix.h b/src/ccstruct/matrix.h index 6feec22336..7dc1bb153b 100644 --- a/src/ccstruct/matrix.h +++ b/src/ccstruct/matrix.h @@ -365,7 +365,7 @@ class GENERIC_2D_ARRAY { } // Accumulates the element-wise sums of squares of src into *this. - void SumSquares(const GENERIC_2D_ARRAY& src, T decay_factor) { + void SumSquares(const GENERIC_2D_ARRAY& src, const T& decay_factor) { T update_factor = 1.0 - decay_factor; int size = num_elements(); for (int i = 0; i < size; ++i) { @@ -377,7 +377,7 @@ class GENERIC_2D_ARRAY { // Scales each element using the adam algorithm, ie array_[i] by // sqrt(sqsum[i] + epsilon)). void AdamUpdate(const GENERIC_2D_ARRAY& sum, - const GENERIC_2D_ARRAY& sqsum, T epsilon) { + const GENERIC_2D_ARRAY& sqsum, const T& epsilon) { int size = num_elements(); for (int i = 0; i < size; ++i) { array_[i] += sum.array_[i] / (sqrt(sqsum.array_[i]) + epsilon);