In Armadillo 8.x and onwards, the arma::SpMat<T>::sync() function needs to be called before accessing any of the following arrays: values, row_indices, col_ptrs. This is due to an internal caching mechanism. Without the call to sync(), the arrays may have outdated data and/or wrong size.
I suggest adding code along these lines, at the start of the function:
There is a bug in compressed_matrix.hpp, where data from an Armadillo sparse matrix is accessed: https://github.com/viennacl/viennacl-dev/blob/489c11964a1e7c32faa1c6d26e1ef43fd856e0ca/viennacl/compressed_matrix.hpp#L267
In Armadillo 8.x and onwards, the
arma::SpMat<T>::sync()
function needs to be called before accessing any of the following arrays:values
,row_indices
,col_ptrs
. This is due to an internal caching mechanism. Without the call tosync()
, the arrays may have outdated data and/or wrong size.I suggest adding code along these lines, at the start of the function:
(CC: @rcurtin)