Hello community, here is the log from the commit of package armadillo for openSUSE:Factory checked in at 2017-09-13 22:38:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/armadillo (Old) and /work/SRC/openSUSE:Factory/.armadillo.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "armadillo" Wed Sep 13 22:38:27 2017 rev:112 rq:525882 version:8.100.1 Changes: -------- --- /work/SRC/openSUSE:Factory/armadillo/armadillo.changes 2017-09-09 20:26:17.820101076 +0200 +++ /work/SRC/openSUSE:Factory/.armadillo.new/armadillo.changes 2017-09-13 22:38:40.285189402 +0200 @@ -1,0 +2,6 @@ +Tue Sep 12 05:55:54 UTC 2017 - [email protected] + +- Update to version 8.100.1: + + Misc bug fixes. + +------------------------------------------------------------------- Old: ---- armadillo-8.100.0.tar.xz New: ---- armadillo-8.100.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ armadillo.spec ++++++ --- /var/tmp/diff_new_pack.TesZFa/_old 2017-09-13 22:38:42.160925304 +0200 +++ /var/tmp/diff_new_pack.TesZFa/_new 2017-09-13 22:38:42.160925304 +0200 @@ -18,7 +18,7 @@ %define soname libarmadillo8 Name: armadillo -Version: 8.100.0 +Version: 8.100.1 Release: 0 Summary: C++ matrix library with interfaces to LAPACK and ATLAS License: Apache-2.0 ++++++ armadillo-8.100.0.tar.xz -> armadillo-8.100.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/docs.html new/armadillo-8.100.1/docs.html --- old/armadillo-8.100.0/docs.html 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/docs.html 2016-06-16 18:17:01.000000000 +0200 @@ -3731,9 +3731,7 @@ <br> <li>For <i>k < 0</i>, the <i>k</i>-th sub-diagonal is accessed (bottom-left corner)</li> <br> -<li> -The diagonal is interpreted as a column vector within expressions -</li> +<li>The diagonal is interpreted as a column vector within expressions</li> <br> <li> Examples: @@ -3751,6 +3749,18 @@ </pre> </ul> </li> +<br> +<li> +<b>NOTE:</b> handling of sparse matrix diagonals has changed slightly in Armadillo 8.x; +to copy sparse diagonal to dense vector, use: +<ul> +<pre> +sp_mat S = sprandu<sp_mat>(10,10,0.1); + +vec v(S.diag()); // copy sparse diagonal to dense vector +</pre> +</ul> +</li> <br> <li> See also: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/Col_bones.hpp new/armadillo-8.100.1/include/armadillo_bits/Col_bones.hpp --- old/armadillo-8.100.0/include/armadillo_bits/Col_bones.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/Col_bones.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -57,14 +57,15 @@ inline Col& operator=(Col&& m); #endif - inline explicit Col(const SpCol<eT>& X); - inline Col& operator=(const eT val); inline Col& operator=(const Col& m); template<typename T1> inline Col(const Base<eT,T1>& X); template<typename T1> inline Col& operator=(const Base<eT,T1>& X); + template<typename T1> inline explicit Col(const SpBase<eT,T1>& X); + template<typename T1> inline Col& operator=(const SpBase<eT,T1>& X); + inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = false); inline Col(const eT* aux_mem, const uword aux_length); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/Col_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/Col_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/Col_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/Col_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -322,23 +322,6 @@ template<typename eT> inline -Col<eT>::Col(const SpCol<eT>& X) - : Mat<eT>(arma_vec_indicator(), X.n_elem, 1, 1) - { - arma_extra_debug_sigprint_this(this); - - arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem); - - for(typename SpCol<eT>::const_iterator it = X.begin(); it != X.end(); ++it) - { - at(it.row()) = (*it); - } - } - - - -template<typename eT> -inline Col<eT>& Col<eT>::operator=(const eT val) { @@ -386,6 +369,34 @@ { arma_extra_debug_sigprint(); + Mat<eT>::operator=(X.get_ref()); + + return *this; + } + + + +template<typename eT> +template<typename T1> +inline +Col<eT>::Col(const SpBase<eT,T1>& X) + : Mat<eT>(arma_vec_indicator(), 1) + { + arma_extra_debug_sigprint_this(this); + + Mat<eT>::operator=(X.get_ref()); + } + + + +template<typename eT> +template<typename T1> +inline +Col<eT>& +Col<eT>::operator=(const SpBase<eT,T1>& X) + { + arma_extra_debug_sigprint(); + Mat<eT>::operator=(X.get_ref()); return *this; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/MapMat_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/MapMat_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/MapMat_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/MapMat_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -141,27 +141,30 @@ { arma_extra_debug_sigprint(); - (*this).zeros(x.n_rows, x.n_cols); + const uword x_n_rows = x.n_rows; + const uword x_n_cols = x.n_cols; + + (*this).zeros(x_n_rows, x_n_cols); if(x.n_nonzero == 0) { return; } - typename SpMat<eT>::const_iterator it = x.begin(); - typename SpMat<eT>::const_iterator it_end = x.end(); + const eT* x_values = x.values; + const uword* x_row_indices = x.row_indices; + const uword* x_col_ptrs = x.col_ptrs; map_type& map_ref = (*map_ptr); - const uword local_n_rows = n_rows; - - for(; it != it_end; ++it) + for(uword col = 0; col < x_n_cols; ++col) { - const eT val = (*it); + const uword start = x_col_ptrs[col ]; + const uword end = x_col_ptrs[col + 1]; - if(val != eT(0)) + for(uword i = start; i < end; ++i) { - const uword row = it.row(); - const uword col = it.col(); + const uword row = x_row_indices[i]; + const eT val = x_values[i]; - const uword index = (local_n_rows * col) + row; + const uword index = (x_n_rows * col) + row; #if defined(ARMA_USE_CXX11) map_ref.emplace_hint(map_ref.cend(), index, val); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/Row_bones.hpp new/armadillo-8.100.1/include/armadillo_bits/Row_bones.hpp --- old/armadillo-8.100.0/include/armadillo_bits/Row_bones.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/Row_bones.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -57,14 +57,15 @@ inline Row& operator=(Row&& m); #endif - inline explicit Row(const SpRow<eT>& X); - inline Row& operator=(const eT val); inline Row& operator=(const Row& X); template<typename T1> inline Row(const Base<eT,T1>& X); template<typename T1> inline Row& operator=(const Base<eT,T1>& X); + template<typename T1> inline explicit Row(const SpBase<eT,T1>& X); + template<typename T1> inline Row& operator=(const SpBase<eT,T1>& X); + inline Row( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = false); inline Row(const eT* aux_mem, const uword aux_length); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/Row_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/Row_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/Row_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/Row_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -322,17 +322,14 @@ template<typename eT> inline -Row<eT>::Row(const SpRow<eT>& X) - : Mat<eT>(arma_vec_indicator(), 1, X.n_elem, 1) +Row<eT>& +Row<eT>::operator=(const eT val) { - arma_extra_debug_sigprint_this(this); - - arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem); - - for(typename SpRow<eT>::const_iterator it = X.begin(); it != X.end(); ++it) - { - at(it.col()) = (*it); - } + arma_extra_debug_sigprint(); + + Mat<eT>::operator=(val); + + return *this; } @@ -340,11 +337,11 @@ template<typename eT> inline Row<eT>& -Row<eT>::operator=(const eT val) +Row<eT>::operator=(const Row<eT>& X) { arma_extra_debug_sigprint(); - Mat<eT>::operator=(val); + Mat<eT>::operator=(X); return *this; } @@ -352,13 +349,27 @@ template<typename eT> +template<typename T1> +inline +Row<eT>::Row(const Base<eT,T1>& X) + : Mat<eT>(arma_vec_indicator(), 2) + { + arma_extra_debug_sigprint(); + + Mat<eT>::operator=(X.get_ref()); + } + + + +template<typename eT> +template<typename T1> inline Row<eT>& -Row<eT>::operator=(const Row<eT>& X) +Row<eT>::operator=(const Base<eT,T1>& X) { arma_extra_debug_sigprint(); - Mat<eT>::operator=(X); + Mat<eT>::operator=(X.get_ref()); return *this; } @@ -368,7 +379,7 @@ template<typename eT> template<typename T1> inline -Row<eT>::Row(const Base<eT,T1>& X) +Row<eT>::Row(const SpBase<eT,T1>& X) : Mat<eT>(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); @@ -382,7 +393,7 @@ template<typename T1> inline Row<eT>& -Row<eT>::operator=(const Base<eT,T1>& X) +Row<eT>::operator=(const SpBase<eT,T1>& X) { arma_extra_debug_sigprint(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpCol_bones.hpp new/armadillo-8.100.1/include/armadillo_bits/SpCol_bones.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpCol_bones.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpCol_bones.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -33,7 +33,8 @@ inline SpCol(); inline explicit SpCol(const uword n_elem); - inline SpCol(const uword in_rows, const uword in_cols); + inline explicit SpCol(const uword in_rows, const uword in_cols); + inline explicit SpCol(const SizeMat& s); inline SpCol(const char* text); inline SpCol& operator=(const char* text); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpCol_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/SpCol_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpCol_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpCol_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -18,28 +18,23 @@ //! @{ -//! construct an empty column vector + template<typename eT> inline SpCol<eT>::SpCol() - : SpMat<eT>(0, 1) + : SpMat<eT>(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; } -//! construct a column vector with the specified number of elements template<typename eT> inline SpCol<eT>::SpCol(const uword in_n_elem) - : SpMat<eT>(in_n_elem, 1) + : SpMat<eT>(arma_vec_indicator(), in_n_elem, 1, 1) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; } @@ -47,74 +42,72 @@ template<typename eT> inline SpCol<eT>::SpCol(const uword in_n_rows, const uword in_n_cols) - : SpMat<eT>(in_n_rows, in_n_cols) + : SpMat<eT>(arma_vec_indicator(), in_n_rows, in_n_cols, 1) { arma_extra_debug_sigprint(); + } - arma_debug_check((in_n_cols != 1), "SpCol::SpCol(): must have only one column"); - access::rw(SpMat<eT>::vec_state) = 1; + +template<typename eT> +inline +SpCol<eT>::SpCol(const SizeMat& s) + : SpMat<eT>(arma_vec_indicator(), 0, 0, 1) + { + arma_extra_debug_sigprint(); + + SpMat<eT>::init(s.n_rows, s.n_cols); } -//! construct a column vector from specified text template<typename eT> inline SpCol<eT>::SpCol(const char* text) - : SpMat<eT>(text) + : SpMat<eT>(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; - - arma_debug_check((SpMat<eT>::n_cols != 1), "SpCol::SpCol(): must have only one column"); + + SpMat<eT>::init(std::string(text)); } -//! construct a column vector from specified text template<typename eT> inline SpCol<eT>& SpCol<eT>::operator=(const char* text) { arma_extra_debug_sigprint(); - + SpMat<eT>::init(std::string(text)); - - access::rw(SpMat<eT>::vec_state) = 1; - + return *this; } -//! construct a column vector from specified text template<typename eT> inline SpCol<eT>::SpCol(const std::string& text) - : SpMat<eT>(text) + : SpMat<eT>(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; - - arma_debug_check((SpMat<eT>::n_cols != 1), "SpCol::SpCol(): must have only one column"); + + SpMat<eT>::init(text); } -//! construct a column vector from specified text template<typename eT> inline SpCol<eT>& SpCol<eT>::operator=(const std::string& text) { arma_extra_debug_sigprint(); - - SpMat<eT>::init(std::string(text)); - + + SpMat<eT>::init(text); + return *this; } @@ -138,11 +131,10 @@ template<typename T1> inline SpCol<eT>::SpCol(const Base<eT,T1>& X) + : SpMat<eT>(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; - + SpMat<eT>::operator=(X.get_ref()); } @@ -155,11 +147,9 @@ SpCol<eT>::operator=(const Base<eT,T1>& X) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; - + SpMat<eT>::operator=(X.get_ref()); - + return *this; } @@ -169,11 +159,10 @@ template<typename T1> inline SpCol<eT>::SpCol(const SpBase<eT,T1>& X) + : SpMat<eT>(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; - + SpMat<eT>::operator=(X.get_ref()); } @@ -186,11 +175,9 @@ SpCol<eT>::operator=(const SpBase<eT,T1>& X) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; - + SpMat<eT>::operator=(X.get_ref()); - + return *this; } @@ -204,11 +191,10 @@ const SpBase<typename SpCol<eT>::pod_type, T1>& A, const SpBase<typename SpCol<eT>::pod_type, T2>& B ) + : SpMat<eT>(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 1; - + SpMat<eT>::init(A,B); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpMat_bones.hpp new/armadillo-8.100.1/include/armadillo_bits/SpMat_bones.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpMat_bones.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpMat_bones.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -577,6 +577,8 @@ inline void init_batch_std(const Mat<uword>& locations, const Mat<eT>& values, const bool sort_locations); inline void init_batch_add(const Mat<uword>& locations, const Mat<eT>& values, const bool sort_locations); + inline SpMat(const arma_vec_indicator&, const uword in_vec_state); + inline SpMat(const arma_vec_indicator&, const uword in_n_rows, const uword in_n_cols, const uword in_vec_state); private: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpMat_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/SpMat_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpMat_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpMat_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -4260,23 +4260,13 @@ { if((in_rows == 0) && (in_cols == 0)) { - if(vec_state == 1) - { - in_cols = 1; - } - else - if(vec_state == 2) - { - in_rows = 1; - } + if(vec_state == 1) { in_cols = 1; } + if(vec_state == 2) { in_rows = 1; } } else { - arma_debug_check - ( - ( ((vec_state == 1) && (in_cols != 1)) || ((vec_state == 2) && (in_rows != 1)) ), - "SpMat::init(): object is a row or column vector; requested size is not compatible" - ); + if(vec_state == 1) { arma_debug_check( (in_cols != 1), "SpMat::init(): object is a column vector; requested size is not compatible" ); } + if(vec_state == 2) { arma_debug_check( (in_rows != 1), "SpMat::init(): object is a row vector; requested size is not compatible" ); } } } @@ -4330,9 +4320,6 @@ -/** - * Initialize the matrix from a string. - */ template<typename eT> inline void @@ -4340,92 +4327,31 @@ { arma_extra_debug_sigprint(); - // Figure out the size first. - uword t_n_rows = 0; - uword t_n_cols = 0; - - bool t_n_cols_found = false; - - std::string token; - - std::string::size_type line_start = 0; - std::string::size_type line_end = 0; - - while (line_start < text.length()) + Mat<eT> tmp(text); + + if(vec_state == 1) { - - line_end = text.find(';', line_start); - - if (line_end == std::string::npos) - line_end = text.length() - 1; - - std::string::size_type line_len = line_end - line_start + 1; - std::stringstream line_stream(text.substr(line_start, line_len)); - - // Step through each column. - uword line_n_cols = 0; - - while (line_stream >> token) + if((tmp.n_elem > 0) && tmp.is_vec()) { - ++line_n_cols; + access::rw(tmp.n_rows) = tmp.n_elem; + access::rw(tmp.n_cols) = 1; } - - if (line_n_cols > 0) - { - if (t_n_cols_found == false) - { - t_n_cols = line_n_cols; - t_n_cols_found = true; - } - else // Check it each time through, just to make sure. - arma_check((line_n_cols != t_n_cols), "SpMat::init(): inconsistent number of columns in given string"); - - ++t_n_rows; - } - - line_start = line_end + 1; - } - - zeros(t_n_rows, t_n_cols); - - // Second time through will pick up all the values. - line_start = 0; - line_end = 0; - - uword lrow = 0; - - while (line_start < text.length()) + + if(vec_state == 2) { - - line_end = text.find(';', line_start); - - if (line_end == std::string::npos) - line_end = text.length() - 1; - - std::string::size_type line_len = line_end - line_start + 1; - std::stringstream line_stream(text.substr(line_start, line_len)); - - uword lcol = 0; - eT val; - - while (line_stream >> val) + if((tmp.n_elem > 0) && tmp.is_vec()) { - if(val != eT(0)) { at(lrow, lcol) = val; } - - ++lcol; + access::rw(tmp.n_rows) = 1; + access::rw(tmp.n_cols) = tmp.n_elem; } - - ++lrow; - line_start = line_end + 1; - } - + + (*this).operator=(tmp); } -/** - * Copy from another matrix. - */ + + template<typename eT> inline void @@ -4787,6 +4713,49 @@ } + +//! constructor used by SpRow and SpCol classes +template<typename eT> +inline +SpMat<eT>::SpMat(const arma_vec_indicator&, const uword in_vec_state) + : n_rows(0) + , n_cols(0) + , n_elem(0) + , n_nonzero(0) + , vec_state(in_vec_state) + , values(NULL) + , row_indices(NULL) + , col_ptrs(NULL) + { + arma_extra_debug_sigprint_this(this); + + const uword in_n_rows = (in_vec_state == 2) ? 1 : 0; + const uword in_n_cols = (in_vec_state == 1) ? 1 : 0; + + init(in_n_rows, in_n_cols); + } + + + +//! constructor used by SpRow and SpCol classes +template<typename eT> +inline +SpMat<eT>::SpMat(const arma_vec_indicator&, const uword in_n_rows, const uword in_n_cols, const uword in_vec_state) + : n_rows(0) + , n_cols(0) + , n_elem(0) + , n_nonzero(0) + , vec_state(in_vec_state) + , values(NULL) + , row_indices(NULL) + , col_ptrs(NULL) + { + arma_extra_debug_sigprint_this(this); + + init(in_n_rows, in_n_cols); + } + + template<typename eT> inline diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpProxy.hpp new/armadillo-8.100.1/include/armadillo_bits/SpProxy.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpProxy.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpProxy.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -258,7 +258,7 @@ } arma_inline uword get_n_rows() const { return Q.n_rows; } - arma_inline uword get_n_cols() const { return Q.n_cols; } + arma_inline uword get_n_cols() const { return 1; } arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpRow_bones.hpp new/armadillo-8.100.1/include/armadillo_bits/SpRow_bones.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpRow_bones.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpRow_bones.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -33,7 +33,8 @@ inline SpRow(); inline explicit SpRow(const uword N); - inline SpRow(const uword in_rows, const uword in_cols); + inline explicit SpRow(const uword in_rows, const uword in_cols); + inline explicit SpRow(const SizeMat& s); inline SpRow(const char* text); inline SpRow& operator=(const char* text); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpRow_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/SpRow_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpRow_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpRow_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -22,11 +22,9 @@ template<typename eT> inline SpRow<eT>::SpRow() - : SpMat<eT>(1, 0) + : SpMat<eT>(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; } @@ -34,11 +32,9 @@ template<typename eT> inline SpRow<eT>::SpRow(const uword in_n_elem) - : SpMat<eT>(1, in_n_elem) + : SpMat<eT>(arma_vec_indicator(), 1, in_n_elem, 2) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; } @@ -46,13 +42,21 @@ template<typename eT> inline SpRow<eT>::SpRow(const uword in_n_rows, const uword in_n_cols) - : SpMat<eT>(in_n_rows, in_n_cols) + : SpMat<eT>(arma_vec_indicator(), in_n_rows, in_n_cols, 2) { arma_extra_debug_sigprint(); + } - arma_debug_check((in_n_rows != 1), "SpRow::SpRow(): must have only one row"); - access::rw(SpMat<eT>::vec_state) = 2; + +template<typename eT> +inline +SpRow<eT>::SpRow(const SizeMat& s) + : SpMat<eT>(arma_vec_indicator(), 0, 0, 2) + { + arma_extra_debug_sigprint(); + + SpMat<eT>::init(s.n_rows, s.n_cols); } @@ -60,13 +64,11 @@ template<typename eT> inline SpRow<eT>::SpRow(const char* text) - : SpMat<eT>(text) + : SpMat<eT>(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; - - arma_debug_check((SpMat<eT>::n_rows != 1), "SpRow::SpRow(): must have only one row"); + + SpMat<eT>::init(std::string(text)); } @@ -77,10 +79,8 @@ SpRow<eT>::operator=(const char* text) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; - SpMat<eT>::operator=(text); + SpMat<eT>::init(std::string(text)); return *this; } @@ -90,13 +90,11 @@ template<typename eT> inline SpRow<eT>::SpRow(const std::string& text) - : SpMat<eT>(text) + : SpMat<eT>(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; - arma_debug_check((SpMat<eT>::n_rows != 1), "SpRow::SpRow(): must have only one row"); + SpMat<eT>::init(text); } @@ -108,7 +106,7 @@ { arma_extra_debug_sigprint(); - SpMat<eT>::operator=(text); + SpMat<eT>::init(text); return *this; } @@ -133,10 +131,9 @@ template<typename T1> inline SpRow<eT>::SpRow(const Base<eT,T1>& X) + : SpMat<eT>(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; SpMat<eT>::operator=(X.get_ref()); } @@ -162,10 +159,9 @@ template<typename T1> inline SpRow<eT>::SpRow(const SpBase<eT,T1>& X) + : SpMat<eT>(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; SpMat<eT>::operator=(X.get_ref()); } @@ -195,10 +191,9 @@ const SpBase<typename SpRow<eT>::pod_type, T1>& A, const SpBase<typename SpRow<eT>::pod_type, T2>& B ) + : SpMat<eT>(arma_vec_indicator(), 2) { arma_extra_debug_sigprint(); - - access::rw(SpMat<eT>::vec_state) = 2; SpMat<eT>::init(A,B); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/SpSubview_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/SpSubview_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/SpSubview_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/SpSubview_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -843,7 +843,15 @@ if(old_val == eT(0)) { - arma_debug_warn("SpSubview::replace(): replacement not done, as old_val = 0"); + if(new_val != eT(0)) + { + Mat<eT> tmp(*this); + + tmp.replace(old_val, new_val); + + (*this).operator=(tmp); + } + return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/arma_version.hpp new/armadillo-8.100.1/include/armadillo_bits/arma_version.hpp --- old/armadillo-8.100.0/include/armadillo_bits/arma_version.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/arma_version.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -21,7 +21,7 @@ #define ARMA_VERSION_MAJOR 8 #define ARMA_VERSION_MINOR 100 -#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_PATCH 1 #define ARMA_VERSION_NAME "Feral Pursuits" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/fn_diagvec.hpp new/armadillo-8.100.1/include/armadillo_bits/fn_diagvec.hpp --- old/armadillo-8.100.0/include/armadillo_bits/fn_diagvec.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/fn_diagvec.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -32,4 +32,17 @@ +template<typename T1> +arma_warn_unused +arma_inline +const SpOp<T1, spop_diagvec> +diagvec(const SpBase<typename T1::elem_type,T1>& X, const sword diag_id = 0) + { + arma_extra_debug_sigprint(); + + return SpOp<T1, spop_diagvec>(X.get_ref(), ((diag_id < 0) ? -diag_id : diag_id), ((diag_id < 0) ? 1 : 0) ); + } + + + //! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/spdiagview_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/spdiagview_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/spdiagview_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/spdiagview_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -689,18 +689,6 @@ const SpMat<eT>& d_m = d.m; - // handle aliasing - if(&out == &d_m) - { - SpMat<eT> tmp; - - spdiagview<eT>::extract(tmp, d); - - out.steal_mem(tmp); - - return; - } - const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/spop_misc_bones.hpp new/armadillo-8.100.1/include/armadillo_bits/spop_misc_bones.hpp --- old/armadillo-8.100.0/include/armadillo_bits/spop_misc_bones.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/spop_misc_bones.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -198,4 +198,14 @@ +class spop_diagvec + { + public: + + template<typename T1> + inline static void apply(SpMat<typename T1::elem_type>& out, const SpOp<T1, spop_diagvec>& in); + }; + + + //! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-8.100.0/include/armadillo_bits/spop_misc_meat.hpp new/armadillo-8.100.1/include/armadillo_bits/spop_misc_meat.hpp --- old/armadillo-8.100.0/include/armadillo_bits/spop_misc_meat.hpp 2016-06-16 18:17:00.000000000 +0200 +++ new/armadillo-8.100.1/include/armadillo_bits/spop_misc_meat.hpp 2016-06-16 18:17:01.000000000 +0200 @@ -467,4 +467,68 @@ +template<typename T1> +inline +void +spop_diagvec::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_diagvec>& in) + { + arma_extra_debug_sigprint(); + + typedef typename T1::elem_type eT; + + const unwrap_spmat<T1> U(in.m); + + const SpMat<eT>& X = U.M; + + const uword a = in.aux_uword_a; + const uword b = in.aux_uword_b; + + const uword row_offset = (b > 0) ? a : 0; + const uword col_offset = (b == 0) ? a : 0; + + arma_debug_check + ( + ((row_offset > 0) && (row_offset >= X.n_rows)) || ((col_offset > 0) && (col_offset >= X.n_cols)), + "diagvec(): requested diagonal out of bounds" + ); + + const uword len = (std::min)(X.n_rows - row_offset, X.n_cols - col_offset); + + Col<eT> cache(len); + eT* cache_mem = cache.memptr(); + + uword n_nonzero = 0; + + for(uword i=0; i < len; ++i) + { + const eT val = X.at(i + row_offset, i + col_offset); + + cache_mem[i] = val; + + n_nonzero += (val != eT(0)) ? uword(1) : uword(0); + } + + out.set_size(len, 1); + + out.mem_resize(n_nonzero); + + uword count = 0; + for(uword i=0; i < len; ++i) + { + const eT val = cache_mem[i]; + + if(val != eT(0)) + { + access::rw(out.row_indices[count]) = i; + access::rw(out.values[count]) = val; + ++count; + } + } + + access::rw(out.col_ptrs[0]) = 0; + access::rw(out.col_ptrs[1]) = n_nonzero; + } + + + //! @}
