| SpMat_meat.hpp | | SpMat_meat.hpp | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| access::rw(col_ptrs[0]) = 0; // No elements. | | access::rw(col_ptrs[0]) = 0; // No elements. | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Clean up the memory of a sparse matrix and destruct it. | | * Clean up the memory of a sparse matrix and destruct it. | |
| */ | | */ | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| SpMat<eT>::~SpMat() | | SpMat<eT>::~SpMat() | |
| { | | { | |
|
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| // If necessary, release the memory. | | // If necessary, release the memory. | |
| if (values) | | if (values) | |
| { | | { | |
| // values being non-NULL implies row_indices is non-NULL. | | // values being non-NULL implies row_indices is non-NULL. | |
| memory::release(access::rw(values)); | | memory::release(access::rw(values)); | |
| memory::release(access::rw(row_indices)); | | memory::release(access::rw(row_indices)); | |
| } | | } | |
| | | | |
| // Column pointers always must be deleted. | | // Column pointers always must be deleted. | |
| | | | |
| skipping to change at line 1320 | | skipping to change at line 1320 | |
| return (*this).operator/=(m); | | return (*this).operator/=(m); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| SpSubview<eT> | | SpSubview<eT> | |
| SpMat<eT>::row(const uword row_num) | | SpMat<eT>::row(const uword row_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | arma_debug_check(row_num >= n_rows, "SpMat::row(): out of bounds"); | |
| | | | |
| return SpSubview<eT>(*this, row_num, 0, 1, n_cols); | | return SpSubview<eT>(*this, row_num, 0, 1, n_cols); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const SpSubview<eT> | | const SpSubview<eT> | |
| SpMat<eT>::row(const uword row_num) const | | SpMat<eT>::row(const uword row_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | arma_debug_check(row_num >= n_rows, "SpMat::row(): out of bounds"); | |
| | | | |
| return SpSubview<eT>(*this, row_num, 0, 1, n_cols); | | return SpSubview<eT>(*this, row_num, 0, 1, n_cols); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| SpSubview<eT> | | SpSubview<eT> | |
| SpMat<eT>::operator()(const uword row_num, const span& col_span) | | SpMat<eT>::operator()(const uword row_num, const span& col_span) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | | |
| skipping to change at line 1394 | | skipping to change at line 1398 | |
| return SpSubview<eT>(*this, row_num, in_col1, 1, submat_n_cols); | | return SpSubview<eT>(*this, row_num, in_col1, 1, submat_n_cols); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| SpSubview<eT> | | SpSubview<eT> | |
| SpMat<eT>::col(const uword col_num) | | SpMat<eT>::col(const uword col_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | arma_debug_check(col_num >= n_cols, "SpMat::col(): out of bounds"); | |
| | | | |
| return SpSubview<eT>(*this, 0, col_num, n_rows, 1); | | return SpSubview<eT>(*this, 0, col_num, n_rows, 1); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const SpSubview<eT> | | const SpSubview<eT> | |
| SpMat<eT>::col(const uword col_num) const | | SpMat<eT>::col(const uword col_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | arma_debug_check(col_num >= n_cols, "SpMat::col(): out of bounds"); | |
| | | | |
| return SpSubview<eT>(*this, 0, col_num, n_rows, 1); | | return SpSubview<eT>(*this, 0, col_num, n_rows, 1); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| SpSubview<eT> | | SpSubview<eT> | |
| SpMat<eT>::operator()(const span& row_span, const uword col_num) | | SpMat<eT>::operator()(const span& row_span, const uword col_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | | |
| skipping to change at line 3230 | | skipping to change at line 3238 | |
| access::rw(new_values[new_n_nonzero]) = 0; | | access::rw(new_values[new_n_nonzero]) = 0; | |
| access::rw(new_row_indices[new_n_nonzero]) = 0; | | access::rw(new_row_indices[new_n_nonzero]) = 0; | |
| | | | |
| if(n_nonzero > 0) | | if(n_nonzero > 0) | |
| { | | { | |
| // Copy old elements. | | // Copy old elements. | |
| uword copy_size = std::min(n_nonzero, new_n_nonzero); | | uword copy_size = std::min(n_nonzero, new_n_nonzero); | |
| | | | |
| arrayops::copy(new_values, values, copy_size); | | arrayops::copy(new_values, values, copy_size); | |
| arrayops::copy(new_row_indices, row_indices, copy_size); | | arrayops::copy(new_row_indices, row_indices, copy_size); | |
|
| | | | |
| memory::release(values); | | | |
| memory::release(row_indices); | | | |
| } | | } | |
| | | | |
|
| | | memory::release(values); | |
| | | memory::release(row_indices); | |
| | | | |
| access::rw(values) = new_values; | | access::rw(values) = new_values; | |
| access::rw(row_indices) = new_row_indices; | | access::rw(row_indices) = new_row_indices; | |
| } | | } | |
| } | | } | |
| | | | |
| access::rw(n_nonzero) = new_n_nonzero; | | access::rw(n_nonzero) = new_n_nonzero; | |
| } | | } | |
| } | | } | |
| | | | |
| // Steal memory from another matrix. | | // Steal memory from another matrix. | |
| | | | |
End of changes. 7 change blocks. |
| 4 lines changed or deleted | | 12 lines changed or added | |
|
| SpValProxy_bones.hpp | | SpValProxy_bones.hpp | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| arma_inline SpValProxy& operator=(const SpValProxy<T2>& rhs); | | arma_inline SpValProxy& operator=(const SpValProxy<T2>& rhs); | |
| | | | |
| //! Overload all of the potential operators. | | //! Overload all of the potential operators. | |
| | | | |
| //! First, the ones that could modify a value. | | //! First, the ones that could modify a value. | |
| arma_inline SpValProxy& operator=(const eT rhs); | | arma_inline SpValProxy& operator=(const eT rhs); | |
| arma_inline SpValProxy& operator+=(const eT rhs); | | arma_inline SpValProxy& operator+=(const eT rhs); | |
| arma_inline SpValProxy& operator-=(const eT rhs); | | arma_inline SpValProxy& operator-=(const eT rhs); | |
| arma_inline SpValProxy& operator*=(const eT rhs); | | arma_inline SpValProxy& operator*=(const eT rhs); | |
| arma_inline SpValProxy& operator/=(const eT rhs); | | arma_inline SpValProxy& operator/=(const eT rhs); | |
|
| arma_inline SpValProxy& operator%=(const eT rhs); | | | |
| arma_inline SpValProxy& operator<<=(const eT rhs); | | | |
| arma_inline SpValProxy& operator>>=(const eT rhs); | | | |
| arma_inline SpValProxy& operator&=(const eT rhs); | | | |
| arma_inline SpValProxy& operator|=(const eT rhs); | | | |
| arma_inline SpValProxy& operator^=(const eT rhs); | | | |
| | | | |
| arma_inline SpValProxy& operator++(); | | arma_inline SpValProxy& operator++(); | |
| arma_inline SpValProxy& operator--(); | | arma_inline SpValProxy& operator--(); | |
| arma_inline eT operator++(const int unused); | | arma_inline eT operator++(const int unused); | |
| arma_inline eT operator--(const int unused); | | arma_inline eT operator--(const int unused); | |
| | | | |
| //! This will work for any other operations that do not modify a value. | | //! This will work for any other operations that do not modify a value. | |
| arma_inline operator eT() const; | | arma_inline operator eT() const; | |
| | | | |
| private: | | private: | |
| | | | |
End of changes. 1 change blocks. |
| 6 lines changed or deleted | | 0 lines changed or added | |
|
| SpValProxy_meat.hpp | | SpValProxy_meat.hpp | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 134 | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| SpValProxy<T1>& | | SpValProxy<T1>& | |
| SpValProxy<T1>::operator*=(const eT rhs) | | SpValProxy<T1>::operator*=(const eT rhs) | |
| { | | { | |
|
| if (rhs != 0) | | if (rhs != eT(0)) | |
| { | | { | |
| | | | |
| if (val_ptr) | | if (val_ptr) | |
| { | | { | |
| // The value already exists and merely needs to be updated. | | // The value already exists and merely needs to be updated. | |
| *val_ptr *= rhs; | | *val_ptr *= rhs; | |
| check_zero(); | | check_zero(); | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| skipping to change at line 208 | | skipping to change at line 208 | |
| | | | |
| } | | } | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| SpValProxy<T1>& | | SpValProxy<T1>& | |
|
| SpValProxy<T1>::operator%=(const eT rhs) | | | |
| { | | | |
| if (val_ptr) | | | |
| { | | | |
| *val_ptr %= rhs; | | | |
| check_zero(); | | | |
| } | | | |
| | | | |
| return *this; | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| SpValProxy<T1>& | | | |
| SpValProxy<T1>::operator<<=(const eT rhs) | | | |
| { | | | |
| // Shifting 0 by any amount should do nothing. | | | |
| if (val_ptr) | | | |
| { | | | |
| *val_ptr <<= rhs; | | | |
| check_zero(); | | | |
| } | | | |
| | | | |
| return *this; | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| SpValProxy<T1>& | | | |
| SpValProxy<T1>::operator>>=(const eT rhs) | | | |
| { | | | |
| // Shifting 0 by any amount should do nothing. | | | |
| if (val_ptr) | | | |
| { | | | |
| *val_ptr <<= rhs; | | | |
| check_zero(); | | | |
| } | | | |
| | | | |
| return *this; | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| SpValProxy<T1>& | | | |
| SpValProxy<T1>::operator&=(const eT rhs) | | | |
| { | | | |
| // Anding with 0 should do nothing. | | | |
| if (val_ptr) | | | |
| { | | | |
| *val_ptr &= rhs; | | | |
| check_zero(); | | | |
| } | | | |
| | | | |
| return *this; | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| SpValProxy<T1>& | | | |
| SpValProxy<T1>::operator|=(const eT rhs) | | | |
| { | | | |
| // Oring with 0 means we assign rhs. | | | |
| if (rhs != eT(0)) | | | |
| { | | | |
| | | | |
| if (val_ptr) | | | |
| { | | | |
| *val_ptr |= rhs; | | | |
| } | | | |
| else | | | |
| { | | | |
| val_ptr = &parent.add_element(row, col, rhs); | | | |
| } | | | |
| | | | |
| } | | | |
| | | | |
| return *this; | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| SpValProxy<T1>& | | | |
| SpValProxy<T1>::operator^=(const eT rhs) | | | |
| { | | | |
| // Xoring 0 with 0 is still 0. | | | |
| if (rhs != eT(0)) | | | |
| { | | | |
| | | | |
| if (val_ptr) | | | |
| { | | | |
| *val_ptr ^= rhs; | | | |
| check_zero(); | | | |
| } | | | |
| else | | | |
| { | | | |
| val_ptr = &parent.add_element(row, col, rhs ^ 0); | | | |
| } | | | |
| | | | |
| } | | | |
| else | | | |
| { | | | |
| | | | |
| if (val_ptr) | | | |
| { | | | |
| *val_ptr ^= rhs; | | | |
| check_zero(); | | | |
| } | | | |
| | | | |
| } | | | |
| | | | |
| return *this; | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| SpValProxy<T1>& | | | |
| SpValProxy<T1>::operator++() | | SpValProxy<T1>::operator++() | |
| { | | { | |
| if (val_ptr) | | if (val_ptr) | |
| { | | { | |
|
| ++(*val_ptr); | | (*val_ptr) += eT(1); | |
| check_zero(); | | check_zero(); | |
| } | | } | |
| | | | |
| else | | else | |
| { | | { | |
|
| val_ptr = &parent.add_element(row, col, 1); | | val_ptr = &parent.add_element(row, col, eT(1)); | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| SpValProxy<T1>& | | SpValProxy<T1>& | |
| SpValProxy<T1>::operator--() | | SpValProxy<T1>::operator--() | |
| { | | { | |
| if (val_ptr) | | if (val_ptr) | |
| { | | { | |
|
| --(*val_ptr); | | (*val_ptr) -= eT(1); | |
| check_zero(); | | check_zero(); | |
| } | | } | |
| | | | |
| else | | else | |
| { | | { | |
|
| val_ptr = &parent.add_element(row, col, -1); | | val_ptr = &parent.add_element(row, col, eT(-1)); | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| typename T1::elem_type | | typename T1::elem_type | |
| SpValProxy<T1>::operator++(const int unused) | | SpValProxy<T1>::operator++(const int unused) | |
| { | | { | |
| if (val_ptr) | | if (val_ptr) | |
| { | | { | |
|
| ++(*val_ptr); | | (*val_ptr) += eT(1); | |
| check_zero(); | | check_zero(); | |
| } | | } | |
| | | | |
| else | | else | |
| { | | { | |
|
| val_ptr = &parent.add_element(row, col, 1); | | val_ptr = &parent.add_element(row, col, eT(1)); | |
| } | | } | |
| | | | |
| if (val_ptr) // It may have changed to now be 0. | | if (val_ptr) // It may have changed to now be 0. | |
| { | | { | |
|
| return *(val_ptr - 1); | | return *(val_ptr) - eT(1); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return eT(0); | | return eT(0); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| typename T1::elem_type | | typename T1::elem_type | |
| SpValProxy<T1>::operator--(const int unused) | | SpValProxy<T1>::operator--(const int unused) | |
| { | | { | |
| if (val_ptr) | | if (val_ptr) | |
| { | | { | |
|
| --(*val_ptr); | | (*val_ptr) -= eT(1); | |
| check_zero(); | | check_zero(); | |
| } | | } | |
| | | | |
| else | | else | |
| { | | { | |
| val_ptr = &parent.add_element(row, col, eT(-1)); | | val_ptr = &parent.add_element(row, col, eT(-1)); | |
| } | | } | |
| | | | |
| if (val_ptr) // It may have changed to now be 0. | | if (val_ptr) // It may have changed to now be 0. | |
| { | | { | |
|
| return *(val_ptr + 1); | | return *(val_ptr) + eT(1); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return eT(0); | | return eT(0); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| SpValProxy<T1>::operator eT() const | | SpValProxy<T1>::operator eT() const | |
| | | | |
| skipping to change at line 437 | | skipping to change at line 321 | |
| arma_hot | | arma_hot | |
| void | | void | |
| SpValProxy<T1>::check_zero() | | SpValProxy<T1>::check_zero() | |
| { | | { | |
| if (*val_ptr == eT(0)) | | if (*val_ptr == eT(0)) | |
| { | | { | |
| parent.delete_element(row, col); | | parent.delete_element(row, col); | |
| val_ptr = NULL; | | val_ptr = NULL; | |
| } | | } | |
| } | | } | |
|
| | | | |
| | | //! @} | |
| | | | |
End of changes. 12 change blocks. |
| 126 lines changed or deleted | | 10 lines changed or added | |
|
| arma_version.hpp | | arma_version.hpp | |
| | | | |
| skipping to change at line 18 | | skipping to change at line 18 | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| //! \addtogroup arma_version | | //! \addtogroup arma_version | |
| //! @{ | | //! @{ | |
| | | | |
| #define ARMA_VERSION_MAJOR 3 | | #define ARMA_VERSION_MAJOR 3 | |
| #define ARMA_VERSION_MINOR 4 | | #define ARMA_VERSION_MINOR 4 | |
|
| #define ARMA_VERSION_PATCH 3 | | #define ARMA_VERSION_PATCH 4 | |
| #define ARMA_VERSION_NAME "Ku De Ta" | | #define ARMA_VERSION_NAME "Ku De Ta" | |
| | | | |
| struct arma_version | | struct arma_version | |
| { | | { | |
| static const unsigned int major = ARMA_VERSION_MAJOR; | | static const unsigned int major = ARMA_VERSION_MAJOR; | |
| static const unsigned int minor = ARMA_VERSION_MINOR; | | static const unsigned int minor = ARMA_VERSION_MINOR; | |
| static const unsigned int patch = ARMA_VERSION_PATCH; | | static const unsigned int patch = ARMA_VERSION_PATCH; | |
| | | | |
| static | | static | |
| inline | | inline | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| diskio_meat.hpp | | diskio_meat.hpp | |
| | | | |
| skipping to change at line 1490 | | skipping to change at line 1490 | |
| { | | { | |
| break; | | break; | |
| } | | } | |
| | | | |
| std::stringstream line_stream(line_string); | | std::stringstream line_stream(line_string); | |
| | | | |
| uword line_n_cols = 0; | | uword line_n_cols = 0; | |
| | | | |
| while(line_stream.good() == true) | | while(line_stream.good() == true) | |
| { | | { | |
|
| getline(line_stream, token, ','); | | std::getline(line_stream, token, ','); | |
| ++line_n_cols; | | ++line_n_cols; | |
| } | | } | |
| | | | |
| if(f_n_cols < line_n_cols) | | if(f_n_cols < line_n_cols) | |
| { | | { | |
| f_n_cols = line_n_cols; | | f_n_cols = line_n_cols; | |
| } | | } | |
| | | | |
| ++f_n_rows; | | ++f_n_rows; | |
| } | | } | |
| | | | |
| skipping to change at line 1524 | | skipping to change at line 1524 | |
| { | | { | |
| break; | | break; | |
| } | | } | |
| | | | |
| std::stringstream line_stream(line_string); | | std::stringstream line_stream(line_string); | |
| | | | |
| uword col = 0; | | uword col = 0; | |
| | | | |
| while(line_stream.good() == true) | | while(line_stream.good() == true) | |
| { | | { | |
|
| getline(line_stream, token, ','); | | std::getline(line_stream, token, ','); | |
| | | | |
| eT val; | | eT val; | |
| | | | |
| std::stringstream ss(token); | | std::stringstream ss(token); | |
| | | | |
| ss >> val; | | ss >> val; | |
| | | | |
| if(ss.fail() == false) | | if(ss.fail() == false) | |
| { | | { | |
| x.at(row,col) = val; | | x.at(row,col) = val; | |
| | | | |
| skipping to change at line 2804 | | skipping to change at line 2804 | |
| // { | | // { | |
| // break; | | // break; | |
| // } | | // } | |
| // | | // | |
| // std::stringstream line_stream(line_string); | | // std::stringstream line_stream(line_string); | |
| // | | // | |
| // uword line_n_cols = 0; | | // uword line_n_cols = 0; | |
| // | | // | |
| // while(line_stream.good() == true) | | // while(line_stream.good() == true) | |
| // { | | // { | |
|
| // getline(line_stream, token, ','); | | // std::getline(line_stream, token, ','); | |
| // ++line_n_cols; | | // ++line_n_cols; | |
| // } | | // } | |
| // | | // | |
| // if(f_n_cols < line_n_cols) | | // if(f_n_cols < line_n_cols) | |
| // { | | // { | |
| // f_n_cols = line_n_cols; | | // f_n_cols = line_n_cols; | |
| // } | | // } | |
| // | | // | |
| // ++f_n_rows; | | // ++f_n_rows; | |
| // } | | // } | |
| | | | |
| skipping to change at line 2837 | | skipping to change at line 2837 | |
| // { | | // { | |
| // break; | | // break; | |
| // } | | // } | |
| // | | // | |
| // std::stringstream line_stream(line_string); | | // std::stringstream line_stream(line_string); | |
| // | | // | |
| // uword col = 0; | | // uword col = 0; | |
| // | | // | |
| // while(line_stream.good() == true) | | // while(line_stream.good() == true) | |
| // { | | // { | |
|
| // getline(line_stream, token, ','); | | // std::getline(line_stream, token, ','); | |
| // | | // | |
| // eT val; | | // eT val; | |
| // | | // | |
| // std::stringstream ss(token); | | // std::stringstream ss(token); | |
| // | | // | |
| // ss >> val; | | // ss >> val; | |
| // | | // | |
| // if(ss.fail() == false) | | // if(ss.fail() == false) | |
| // { | | // { | |
| // x.at(row,col) = val; | | // x.at(row,col) = val; | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| fn_n_unique.hpp | | fn_n_unique.hpp | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 63 | |
| // Use iterators. | | // Use iterators. | |
| typename SpProxy<T1>::const_iterator_type x_it = pa.begin(); | | typename SpProxy<T1>::const_iterator_type x_it = pa.begin(); | |
| typename SpProxy<T2>::const_iterator_type y_it = pb.begin(); | | typename SpProxy<T2>::const_iterator_type y_it = pb.begin(); | |
| | | | |
| uword total_n_nonzero = 0; | | uword total_n_nonzero = 0; | |
| | | | |
| while((x_it != pa.end()) || (y_it != pb.end())) | | while((x_it != pa.end()) || (y_it != pb.end())) | |
| { | | { | |
| if(x_it == y_it) | | if(x_it == y_it) | |
| { | | { | |
|
| if(op_n_unique_type::eval((*x_it), (*y_it)) != 0) | | if(op_n_unique_type::eval((*x_it), (*y_it)) != typename T1::elem_type
(0)) | |
| { | | { | |
| ++total_n_nonzero; | | ++total_n_nonzero; | |
| } | | } | |
| | | | |
| ++x_it; | | ++x_it; | |
| ++y_it; | | ++y_it; | |
| } | | } | |
| else | | else | |
| { | | { | |
| if((x_it.col() < y_it.col()) || ((x_it.col() == y_it.col()) && (x_it.
row() < y_it.row()))) // if y is closer to the end | | if((x_it.col() < y_it.col()) || ((x_it.col() == y_it.col()) && (x_it.
row() < y_it.row()))) // if y is closer to the end | |
| { | | { | |
|
| if(op_n_unique_type::eval((*x_it), typename T1::elem_type(0)) != 0) | | if(op_n_unique_type::eval((*x_it), typename T1::elem_type(0)) != ty
pename T1::elem_type(0)) | |
| { | | { | |
| ++total_n_nonzero; | | ++total_n_nonzero; | |
| } | | } | |
| | | | |
| ++x_it; | | ++x_it; | |
| } | | } | |
| else // x is closer to the end | | else // x is closer to the end | |
| { | | { | |
|
| if(op_n_unique_type::eval(typename T1::elem_type(0), (*y_it)) != 0) | | if(op_n_unique_type::eval(typename T1::elem_type(0), (*y_it)) != ty
pename T1::elem_type(0)) | |
| { | | { | |
| ++total_n_nonzero; | | ++total_n_nonzero; | |
| } | | } | |
| | | | |
| ++y_it; | | ++y_it; | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| return total_n_nonzero; | | return total_n_nonzero; | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|