diff --git a/include/armadillo_bits/Mat_meat.hpp b/include/armadillo_bits/Mat_meat.hpp index 8f1a7db2..2fd9b1fa 100644 --- a/include/armadillo_bits/Mat_meat.hpp +++ b/include/armadillo_bits/Mat_meat.hpp @@ -2669,12 +2669,12 @@ Mat::operator/=(const SpBase& m) { arma_extra_debug_sigprint(); + // NOTE: use of this function is not advised; it is implemented only for completeness + const SpProxy p(m.get_ref()); arma_debug_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division"); - // If you use this method, you are probably stupid or misguided, but for completeness it is implemented. - // Unfortunately the best way to do this is loop over every element. for(uword c = 0; c < n_cols; ++c) for(uword r = 0; r < n_rows; ++r) { diff --git a/include/armadillo_bits/SpMat_meat.hpp b/include/armadillo_bits/SpMat_meat.hpp index 5862f1aa..5100a90c 100644 --- a/include/armadillo_bits/SpMat_meat.hpp +++ b/include/armadillo_bits/SpMat_meat.hpp @@ -778,16 +778,14 @@ SpMat::operator/=(const SpMat& x) { arma_extra_debug_sigprint(); + // NOTE: use of this function is not advised; it is implemented only for completeness + arma_debug_assert_same_size(n_rows, n_cols, x.n_rows, x.n_cols, "element-wise division"); - // If you use this method, you are probably stupid or misguided, - // but for compatibility with Mat, we have implemented it anyway. for(uword c = 0; c < n_cols; ++c) + for(uword r = 0; r < n_rows; ++r) { - for(uword r = 0; r < n_rows; ++r) - { - at(r, c) /= x.at(r, c); - } + at(r, c) /= x.at(r, c); } return *this; diff --git a/include/armadillo_bits/SpSubview_meat.hpp b/include/armadillo_bits/SpSubview_meat.hpp index 7e5bbb7f..e05b7239 100644 --- a/include/armadillo_bits/SpSubview_meat.hpp +++ b/include/armadillo_bits/SpSubview_meat.hpp @@ -476,7 +476,6 @@ SpSubview::operator%=(const SpBase& x) -//! If you are using this function, you are probably misguided. template template inline @@ -485,6 +484,8 @@ SpSubview::operator/=(const SpBase& x) { arma_extra_debug_sigprint(); + // NOTE: use of this function is not advised; it is implemented only for completeness + SpProxy p(x.get_ref()); arma_debug_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division"); diff --git a/include/armadillo_bits/sp_auxlib_meat.hpp b/include/armadillo_bits/sp_auxlib_meat.hpp index d08a0762..917927cb 100644 --- a/include/armadillo_bits/sp_auxlib_meat.hpp +++ b/include/armadillo_bits/sp_auxlib_meat.hpp @@ -1570,7 +1570,7 @@ sp_auxlib::spsolve_refine(Mat& X, typename T1::pod_type& // We have to actually create the object which stores the data. // This gets cleaned by destroy_supermatrix(). - // We have to use SuperLU's stupid memory allocation routines since they are + // We have to use SuperLU's problematic memory allocation routines since they are // not guaranteed to be new and delete. See the comments in def_superlu.hpp superlu::NCformat* nc = (superlu::NCformat*)superlu::malloc(sizeof(superlu::NCformat));