diff --git a/include/armadillo_bits/fn_ones.hpp b/include/armadillo_bits/fn_ones.hpp index 0335756d..ae8b6220 100644 --- a/include/armadillo_bits/fn_ones.hpp +++ b/include/armadillo_bits/fn_ones.hpp @@ -43,14 +43,10 @@ ones(const uword n_elem, const arma_empty_class junk1 = arma_empty_class(), cons arma_ignore(junk1); arma_ignore(junk2); - if(is_Row::value) - { - return Gen(1, n_elem); - } - else - { - return Gen(n_elem, 1); - } + const uword n_rows = (is_Row::value) ? uword(1) : n_elem; + const uword n_cols = (is_Row::value) ? n_elem : uword(1); + + return Gen(n_rows, n_cols); } diff --git a/include/armadillo_bits/fn_zeros.hpp b/include/armadillo_bits/fn_zeros.hpp index cb45d405..5f069223 100644 --- a/include/armadillo_bits/fn_zeros.hpp +++ b/include/armadillo_bits/fn_zeros.hpp @@ -43,14 +43,10 @@ zeros(const uword n_elem, const arma_empty_class junk1 = arma_empty_class(), con arma_ignore(junk1); arma_ignore(junk2); - if(is_Row::value) - { - return Gen(1, n_elem); - } - else - { - return Gen(n_elem, 1); - } + const uword n_rows = (is_Row::value) ? uword(1) : n_elem; + const uword n_cols = (is_Row::value) ? n_elem : uword(1); + + return Gen(n_rows, n_cols); }