SpMat_meat.hpp | SpMat_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 3262 | skipping to change at line 3262 | |||
// Steal memory from another matrix. | // Steal memory from another matrix. | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
SpMat<eT>::steal_mem(SpMat<eT>& x) | SpMat<eT>::steal_mem(SpMat<eT>& x) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(this != &x) | if(this != &x) | |||
{ | { | |||
reset(); // Clear all existing information about this matrix. | // Release all the memory. | |||
memory::release(values); | ||||
// Even the column pointers. | memory::release(row_indices); | |||
memory::release(col_ptrs); | memory::release(col_ptrs); | |||
// We'll have to copy everything about the other matrix. | // We'll have to copy everything about the other matrix. | |||
const uword x_n_rows = x.n_rows; | const uword x_n_rows = x.n_rows; | |||
const uword x_n_cols = x.n_cols; | const uword x_n_cols = x.n_cols; | |||
const uword x_n_elem = x.n_elem; | const uword x_n_elem = x.n_elem; | |||
const uword x_n_nonzero = x.n_nonzero; | const uword x_n_nonzero = x.n_nonzero; | |||
access::rw(n_rows) = x_n_rows; | access::rw(n_rows) = x_n_rows; | |||
access::rw(n_cols) = x_n_cols; | access::rw(n_cols) = x_n_cols; | |||
End of changes. 1 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
SpSubview_meat.hpp | SpSubview_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 674 | skipping to change at line 674 | |||
if(val != eT(0)) | if(val != eT(0)) | |||
{ | { | |||
// TODO: implement a faster version; the code below is slow | // TODO: implement a faster version; the code below is slow | |||
const uword start_row = aux_row1; | const uword start_row = aux_row1; | |||
const uword end_row = aux_row1 + n_rows; | const uword end_row = aux_row1 + n_rows; | |||
const uword start_col = aux_col1; | const uword start_col = aux_col1; | |||
const uword end_col = aux_col1 + n_cols; | const uword end_col = aux_col1 + n_cols; | |||
const uword orig_nonzero = m.n_nonzero; | ||||
// iterate over our part of the sparse matrix | // iterate over our part of the sparse matrix | |||
for(uword col = start_col; col < end_col; ++col) | for(uword col = start_col; col < end_col; ++col) | |||
for(uword row = start_row; row < end_row; ++row) | for(uword row = start_row; row < end_row; ++row) | |||
{ | { | |||
access::rw(m).at(row, col) = val; | access::rw(m).at(row, col) = val; | |||
} | } | |||
access::rw(n_nonzero) += (m.n_nonzero - orig_nonzero); | ||||
} | } | |||
else | else | |||
{ | { | |||
(*this).zeros(); | (*this).zeros(); | |||
} | } | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
skipping to change at line 725 | skipping to change at line 730 | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
SpSubview<eT>::eye() | SpSubview<eT>::eye() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
// clear other things | // clear other things | |||
(*this).zeros(); | (*this).zeros(); | |||
const uword orig_nonzero = m.n_nonzero; | ||||
// now the diagonal ones | // now the diagonal ones | |||
const uword end_index = std::min(n_rows, n_cols); | const uword end_index = std::min(n_rows, n_cols); | |||
for(uword ind = 0; ind < end_index; ++ind) | for(uword ind = 0; ind < end_index; ++ind) | |||
{ | { | |||
access::rw(m).at(ind + aux_row1, ind + aux_col1) = eT(1); | access::rw(m).at(ind + aux_row1, ind + aux_col1) = eT(1); | |||
} | } | |||
access::rw(n_nonzero) += (m.n_nonzero - orig_nonzero); | ||||
} | } | |||
template<typename eT> | template<typename eT> | |||
arma_hot | arma_hot | |||
inline | inline | |||
SpValProxy<SpSubview<eT> > | SpValProxy<SpSubview<eT> > | |||
SpSubview<eT>::operator[](const uword i) | SpSubview<eT>::operator[](const uword i) | |||
{ | { | |||
const uword row = i % n_rows; | const uword row = i % n_rows; | |||
const uword col = i / n_rows; | const uword col = i / n_rows; | |||
skipping to change at line 767 | skipping to change at line 776 | |||
template<typename eT> | template<typename eT> | |||
arma_hot | arma_hot | |||
inline | inline | |||
SpValProxy< SpSubview<eT> > | SpValProxy< SpSubview<eT> > | |||
SpSubview<eT>::operator()(const uword i) | SpSubview<eT>::operator()(const uword i) | |||
{ | { | |||
arma_debug_check( (i >= n_elem), "SpSubview::operator(): index out of bou nds"); | arma_debug_check( (i >= n_elem), "SpSubview::operator(): index out of bou nds"); | |||
const uword row = i % n_rows; | const uword row = i % n_rows; | |||
const uword col = i / n_cols; | const uword col = i / n_rows; | |||
return (*this).at(row, col); | return (*this).at(row, col); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
arma_hot | arma_hot | |||
inline | inline | |||
eT | eT | |||
SpSubview<eT>::operator()(const uword i) const | SpSubview<eT>::operator()(const uword i) const | |||
{ | { | |||
arma_debug_check( (i >= n_elem), "SpSubview::operator(): index out of bou nds"); | arma_debug_check( (i >= n_elem), "SpSubview::operator(): index out of bou nds"); | |||
const uword row = i % n_rows; | const uword row = i % n_rows; | |||
const uword col = i / n_cols; | const uword col = i / n_rows; | |||
return (*this).at(row, col); | return (*this).at(row, col); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
arma_hot | arma_hot | |||
inline | inline | |||
SpValProxy< SpSubview<eT> > | SpValProxy< SpSubview<eT> > | |||
SpSubview<eT>::operator()(const uword in_row, const uword in_col) | SpSubview<eT>::operator()(const uword in_row, const uword in_col) | |||
{ | { | |||
End of changes. 6 change blocks. | ||||
2 lines changed or deleted | 11 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 4 | #define ARMA_VERSION_PATCH 5 | |||
#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 | |||
operator_div.hpp | operator_div.hpp | |||
---|---|---|---|---|
skipping to change at line 221 | skipping to change at line 221 | |||
const SpProxy<T1> pa(x.get_ref()); | const SpProxy<T1> pa(x.get_ref()); | |||
const Proxy<T2> pb(y.get_ref()); | const Proxy<T2> pb(y.get_ref()); | |||
arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise division"); | arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise division"); | |||
SpMat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols()); | SpMat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols()); | |||
// The compiler should be smart enough to optimize out the inner if/else statement entirely | // The compiler should be smart enough to optimize out the inner if/else statement entirely | |||
typename SpProxy<T1>::const_iterator_type it = pa.begin(); | typename SpProxy<T1>::const_iterator_type it = pa.begin(); | |||
uword new_n_nonzero; | uword new_n_nonzero = 0; | |||
while(it != pa.end()) | while(it != pa.end()) | |||
{ | { | |||
if(Proxy<T2>::prefer_at_accessor == false) | if(Proxy<T2>::prefer_at_accessor == false) | |||
{ | { | |||
const typename T1::elem_type val = (*it) / pb[(it.col() * pb.get_n_ro ws()) + it.row()]; | const typename T1::elem_type val = (*it) / pb[(it.col() * pb.get_n_ro ws()) + it.row()]; | |||
if(val != 0) | if(val != 0) | |||
{ | { | |||
++new_n_nonzero; | ++new_n_nonzero; | |||
} | } | |||
} | } | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
traits.hpp | traits.hpp | |||
---|---|---|---|---|
skipping to change at line 608 | skipping to change at line 608 | |||
template<typename T1, typename op_type> | template<typename T1, typename op_type> | |||
struct is_SpOp< SpOp<T1,op_type> > | struct is_SpOp< SpOp<T1,op_type> > | |||
{ static const bool value = true; }; | { static const bool value = true; }; | |||
template<typename T> | template<typename T> | |||
struct is_SpGlue | struct is_SpGlue | |||
{ static const bool value = false; }; | { static const bool value = false; }; | |||
template<typename T1, typename T2, typename glue_type> | template<typename T1, typename T2, typename glue_type> | |||
struct is_SpOp< SpGlue<T1,T2,glue_type> > | struct is_SpGlue< SpGlue<T1,T2,glue_type> > | |||
{ static const bool value = true; }; | { static const bool value = true; }; | |||
template<typename T1> | template<typename T1> | |||
struct is_arma_sparse_type | struct is_arma_sparse_type | |||
{ | { | |||
static const bool value | static const bool value | |||
= is_SpMat<T1>::value | = is_SpMat<T1>::value | |||
|| is_SpSubview<T1>::value | || is_SpSubview<T1>::value | |||
|| is_SpOp<T1>::value | || is_SpOp<T1>::value | |||
|| is_SpGlue<T1>::value | || is_SpGlue<T1>::value | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||