Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package armadillo for openSUSE:Factory checked in at 2021-07-10 22:54:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/armadillo (Old) and /work/SRC/openSUSE:Factory/.armadillo.new.2625 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "armadillo" Sat Jul 10 22:54:46 2021 rev:150 rq:905556 version:10.5.3 Changes: -------- --- /work/SRC/openSUSE:Factory/armadillo/armadillo.changes 2021-06-24 18:22:39.376921681 +0200 +++ /work/SRC/openSUSE:Factory/.armadillo.new.2625/armadillo.changes 2021-07-10 22:55:16.987397055 +0200 @@ -1,0 +2,7 @@ +Fri Jul 9 20:37:25 UTC 2021 - Ferdinand Thiessen <[email protected]> + +- Update to version 10.5.3 + * fix for handling sparse matrices with no elements + * minor speedups + +------------------------------------------------------------------- Old: ---- armadillo-10.5.2.tar.xz New: ---- armadillo-10.5.3.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ armadillo.spec ++++++ --- /var/tmp/diff_new_pack.zpTpcp/_old 2021-07-10 22:55:17.659391869 +0200 +++ /var/tmp/diff_new_pack.zpTpcp/_new 2021-07-10 22:55:17.659391869 +0200 @@ -18,7 +18,7 @@ %define soname libarmadillo10 Name: armadillo -Version: 10.5.2 +Version: 10.5.3 Release: 0 Summary: C++ matrix library with interfaces to LAPACK and ATLAS License: Apache-2.0 ++++++ armadillo-10.5.2.tar.xz -> armadillo-10.5.3.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-10.5.2/docs.html new/armadillo-10.5.3/docs.html --- old/armadillo-10.5.2/docs.html 2016-06-16 18:23:02.000000000 +0200 +++ new/armadillo-10.5.3/docs.html 2016-06-16 18:23:03.000000000 +0200 @@ -378,7 +378,7 @@ <tr style="background-color: #F5F5F5;"><td><a href="#clamp">clamp</a></td><td> </td><td>obtain clamped elements according to given limits</td></tr> <tr><td><a href="#cond">cond</a></td><td> </td><td>condition number of matrix</td></tr> <tr><td><a href="#conj">conj</a></td><td> </td><td>obtain complex conjugate of each element</td></tr> -<tr><td><a href="#conv_to">conv_to</a></td><td> </td><td>convert between matrix types</td></tr> +<tr><td><a href="#conv_to">conv_to</a></td><td> </td><td>convert/cast between matrix types</td></tr> <tr style="background-color: #F5F5F5;"><td><a href="#cross">cross</a></td><td> </td><td>cross product</td></tr> <tr style="background-color: #F5F5F5;"><td><a href="#cumsum">cumsum</a></td><td> </td><td>cumulative sum</td></tr> <tr style="background-color: #F5F5F5;"><td><a href="#cumprod">cumprod</a></td><td> </td><td>cumulative product</td></tr> @@ -8618,7 +8618,7 @@ </b> <ul> <li> -Convert from one matrix type to another (eg. <i>mat</i> to <i>imat</i>), or one cube type to another (eg. <i>cube</i> to <i>icube</i>) +Convert (cast) from one matrix type to another (eg. <i>mat</i> to <i>imat</i>), or one cube type to another (eg. <i>cube</i> to <i>icube</i>) </li> <br> <li> @@ -8633,7 +8633,7 @@ Examples: <ul> <pre> -mat A(5, 5, fill::randu); + mat A(5, 5, fill::randu); fmat B = conv_to<fmat>::from(A); typedef std::vector<double> stdvec; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-10.5.2/include/armadillo_bits/arma_version.hpp new/armadillo-10.5.3/include/armadillo_bits/arma_version.hpp --- old/armadillo-10.5.2/include/armadillo_bits/arma_version.hpp 2016-06-16 18:23:02.000000000 +0200 +++ new/armadillo-10.5.3/include/armadillo_bits/arma_version.hpp 2016-06-16 18:23:03.000000000 +0200 @@ -21,7 +21,7 @@ #define ARMA_VERSION_MAJOR 10 #define ARMA_VERSION_MINOR 5 -#define ARMA_VERSION_PATCH 2 +#define ARMA_VERSION_PATCH 3 #define ARMA_VERSION_NAME "Antipodean Fortress" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-10.5.2/include/armadillo_bits/spop_normalise_bones.hpp new/armadillo-10.5.3/include/armadillo_bits/spop_normalise_bones.hpp --- old/armadillo-10.5.2/include/armadillo_bits/spop_normalise_bones.hpp 2016-06-16 18:23:02.000000000 +0200 +++ new/armadillo-10.5.3/include/armadillo_bits/spop_normalise_bones.hpp 2016-06-16 18:23:03.000000000 +0200 @@ -27,7 +27,7 @@ inline static void apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_normalise>& expr); template<typename eT> - inline static void apply_direct(SpMat<eT>& out, const SpMat<eT>& X, const uword p, const uword dim); + inline static void apply_direct(SpMat<eT>& out, const SpMat<eT>& X, const uword p); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-10.5.2/include/armadillo_bits/spop_normalise_meat.hpp new/armadillo-10.5.3/include/armadillo_bits/spop_normalise_meat.hpp --- old/armadillo-10.5.2/include/armadillo_bits/spop_normalise_meat.hpp 2016-06-16 18:23:02.000000000 +0200 +++ new/armadillo-10.5.3/include/armadillo_bits/spop_normalise_meat.hpp 2016-06-16 18:23:03.000000000 +0200 @@ -26,6 +26,8 @@ { arma_extra_debug_sigprint(); + typedef typename T1::elem_type eT; + const uword p = expr.aux_uword_a; const uword dim = expr.aux_uword_b; @@ -34,7 +36,28 @@ const unwrap_spmat<T1> U(expr.m); - spop_normalise::apply_direct(out, U.M, p, dim); + const SpMat<eT>& X = U.M; + + X.sync(); + + if( X.is_empty() || (X.n_nonzero == 0) ) { out.zeros(X.n_rows, X.n_cols); return; } + + if(dim == 0) + { + spop_normalise::apply_direct(out, X, p); + } + else + if(dim == 1) + { + SpMat<eT> tmp1; + SpMat<eT> tmp2; + + spop_strans::apply_noalias(tmp1, X); + + spop_normalise::apply_direct(tmp2, tmp1, p); + + spop_strans::apply_noalias(out, tmp2); + } } @@ -42,162 +65,65 @@ template<typename eT> inline void -spop_normalise::apply_direct(SpMat<eT>& out, const SpMat<eT>& X, const uword p, const uword dim) +spop_normalise::apply_direct(SpMat<eT>& out, const SpMat<eT>& X, const uword p) { arma_extra_debug_sigprint(); typedef typename get_pod_type<eT>::result T; - X.sync(); + SpMat<eT> tmp(arma_reserve_indicator(), X.n_rows, X.n_cols, X.n_nonzero); - if( X.is_empty() || (X.n_nonzero == 0) ) { return; } + bool has_zero = false; - if(dim == 0) + podarray<T> norm_vals(X.n_cols); + + T* norm_vals_mem = norm_vals.memptr(); + + for(uword col=0; col < X.n_cols; ++col) { - podarray<T> norm_vals(X.n_cols); + const uword col_offset = X.col_ptrs[col ]; + const uword next_col_offset = X.col_ptrs[col + 1]; - T* norm_vals_mem = norm_vals.memptr(); + const eT* start_ptr = &X.values[ col_offset]; + const eT* end_ptr = &X.values[next_col_offset]; - for(uword i=0; i < norm_vals.n_elem; ++i) - { - const uword col_offset = X.col_ptrs[i ]; - const uword next_col_offset = X.col_ptrs[i + 1]; - - const eT* start_ptr = &X.values[ col_offset]; - const eT* end_ptr = &X.values[next_col_offset]; - - const uword n_elem = end_ptr - start_ptr; - - const Col<eT> fake_vec(const_cast<eT*>(start_ptr), n_elem, false, false); - - const T norm_val = norm(fake_vec, p); - - norm_vals_mem[i] = (norm_val != T(0)) ? norm_val : T(1); - } - - const uword N = X.n_nonzero; - - umat locs(2, N, arma_nozeros_indicator()); - Col<eT> vals( N, arma_nozeros_indicator()); - - uword* locs_mem = locs.memptr(); - eT* vals_mem = vals.memptr(); - - typename SpMat<eT>::const_iterator it = X.begin(); - - uword new_n_nonzero = 0; - - for(uword i=0; i < N; ++i) - { - const uword row = it.row(); - const uword col = it.col(); - - const eT val = (*it) / norm_vals_mem[col]; - - if(val != eT(0)) - { - (*vals_mem) = val; vals_mem++; - - (*locs_mem) = row; locs_mem++; - (*locs_mem) = col; locs_mem++; - - new_n_nonzero++; - } - - ++it; - } + const uword n_elem = end_ptr - start_ptr; - const umat tmp_locs(locs.memptr(), 2, new_n_nonzero, false, false); - const Col<eT> tmp_vals(vals.memptr(), new_n_nonzero, false, false); + const Col<eT> fake_vec(const_cast<eT*>(start_ptr), n_elem, false, false); - SpMat<eT> tmp(tmp_locs, tmp_vals, X.n_rows, X.n_cols, false, false); + const T norm_val = norm(fake_vec, p); - out.steal_mem(tmp); + norm_vals_mem[col] = (norm_val != T(0)) ? norm_val : T(1); } - else - if(dim == 1) + + const uword N = X.n_nonzero; + + typename SpMat<eT>::const_iterator it = X.begin(); + + for(uword i=0; i < N; ++i) { - podarray< T> norm_vals(X.n_rows); - podarray<eT> row_vals(X.n_cols); // worst case scenario - - T* norm_vals_mem = norm_vals.memptr(); - eT* row_vals_mem = row_vals.memptr(); + const uword row = it.row(); + const uword col = it.col(); - for(uword i=0; i < norm_vals.n_elem; ++i) - { - // typename SpMat<eT>::const_row_iterator row_it = X.begin_row(i); - // typename SpMat<eT>::const_row_iterator row_it_end = X.end_row(i); - // - // uword count = 0; - // - // for(; row_it != row_it_end; ++row_it) - // { - // row_vals_mem[count] = (*row_it); - // ++count; - // } - - - // using the .at() accessor, as it's faster than const_row_iterator for accessing a single row - - uword count = 0; - - for(uword col=0; col < X.n_cols; ++col) - { - const eT val = X.at(i,col); - - if(val != eT(0)) - { - row_vals_mem[count] = val; - ++count; - } - } - - const Row<eT> fake_vec(row_vals_mem, count, false, false); - - const T norm_val = norm(fake_vec, p); - - norm_vals_mem[i] = (norm_val != T(0)) ? norm_val : T(1); - } - - const uword N = X.n_nonzero; - - umat locs(2, N, arma_nozeros_indicator()); - Col<eT> vals( N, arma_nozeros_indicator()); - - uword* locs_mem = locs.memptr(); - eT* vals_mem = vals.memptr(); - - typename SpMat<eT>::const_iterator it = X.begin(); - - uword new_n_nonzero = 0; - - for(uword i=0; i < N; ++i) - { - const uword row = it.row(); - const uword col = it.col(); - - const eT val = (*it) / norm_vals_mem[row]; - - if(val != eT(0)) - { - (*vals_mem) = val; vals_mem++; - - (*locs_mem) = row; locs_mem++; - (*locs_mem) = col; locs_mem++; - - new_n_nonzero++; - } - - ++it; - } + const eT val = (*it) / norm_vals_mem[col]; - const umat tmp_locs(locs.memptr(), 2, new_n_nonzero, false, false); - const Col<eT> tmp_vals(vals.memptr(), new_n_nonzero, false, false); + if(val == eT(0)) { has_zero = true; } - SpMat<eT> tmp(tmp_locs, tmp_vals, X.n_rows, X.n_cols, false, false); + access::rw(tmp.values[i]) = val; + access::rw(tmp.row_indices[i]) = row; + access::rw(tmp.col_ptrs[col + 1])++; - out.steal_mem(tmp); + ++it; } + + for(uword c=0; c < tmp.n_cols; ++c) + { + access::rw(tmp.col_ptrs[c + 1]) += tmp.col_ptrs[c]; + } + + if(has_zero) { tmp.remove_zeros(); } + + out.steal_mem(tmp); }
