From 68ac4064682fa0062df0e6e209612efd8da763bf Mon Sep 17 00:00:00 2001 From: conrad Date: Fri, 17 Dec 2021 22:22:47 +1000 Subject: [PATCH] rename variables to clarify intent --- include/armadillo_bits/op_reshape_meat.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/armadillo_bits/op_reshape_meat.hpp b/include/armadillo_bits/op_reshape_meat.hpp index f51ec732..85f6eff0 100644 --- a/include/armadillo_bits/op_reshape_meat.hpp +++ b/include/armadillo_bits/op_reshape_meat.hpp @@ -78,15 +78,15 @@ op_reshape::apply_proxy(Mat& out, const Proxy& P, co eT* out_mem = out.memptr(); - const uword in_n_elem = new_n_rows * new_n_cols; + const uword out_n_elem = new_n_rows * new_n_cols; - if(P.get_n_elem() == in_n_elem) + if(P.get_n_elem() == out_n_elem) { if(Proxy::use_at == false) { typename Proxy::ea_type Pea = P.get_ea(); - for(uword i=0; i < in_n_elem; ++i) { out_mem[i] = Pea[i]; } + for(uword i=0; i < out_n_elem; ++i) { out_mem[i] = Pea[i]; } } else { @@ -115,7 +115,7 @@ op_reshape::apply_proxy(Mat& out, const Proxy& P, co } else { - const uword n_elem_to_copy = (std::min)(P.get_n_elem(), in_n_elem); + const uword n_elem_to_copy = (std::min)(P.get_n_elem(), out_n_elem); if(Proxy::use_at == false) { @@ -143,7 +143,7 @@ op_reshape::apply_proxy(Mat& out, const Proxy& P, co nested_loop_end: ; } - for(uword i=n_elem_to_copy; i < in_n_elem; ++i) { out_mem[i] = eT(0); } + for(uword i=n_elem_to_copy; i < out_n_elem; ++i) { out_mem[i] = eT(0); } } } @@ -227,9 +227,9 @@ op_reshape::apply(Cube& out, const OpCube const uword new_n_cols = in.aux_uword_b; const uword new_n_slices = in.aux_uword_c; - const uword in_n_elem = new_n_rows * new_n_cols * new_n_slices; + const uword out_n_elem = new_n_rows * new_n_cols * new_n_slices; - if(A.n_elem == in_n_elem) + if(A.n_elem == out_n_elem) { if(&out != &A) { @@ -247,7 +247,7 @@ op_reshape::apply(Cube& out, const OpCube const unwrap_cube_check< Cube > B_tmp(A, out); const Cube& B = B_tmp.M; - const uword n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); + const uword n_elem_to_copy = (std::min)(B.n_elem, out_n_elem); out.set_size(new_n_rows, new_n_cols, new_n_slices); @@ -255,7 +255,7 @@ op_reshape::apply(Cube& out, const OpCube arrayops::copy( out_mem, B.memptr(), n_elem_to_copy ); - for(uword i=n_elem_to_copy; i < in_n_elem; ++i) { out_mem[i] = eT(0); } + for(uword i=n_elem_to_copy; i < out_n_elem; ++i) { out_mem[i] = eT(0); } } }