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 <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-10-06 19:48:13 +02:00
parent a7982185c9
commit 238c872753

View File

@ -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<T>& src, T decay_factor) {
void SumSquares(const GENERIC_2D_ARRAY<T>& 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<T>& sum,
const GENERIC_2D_ARRAY<T>& sqsum, T epsilon) {
const GENERIC_2D_ARRAY<T>& 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);