I have to replace some columns in a sparse matrix with columns from another sparse matrix that has the same nonzero elements, just different values, based on a condition. I am struggling with write access using iterators in Armadillo. The docs say that using sp_mat::col_iterator provides read/write access, however, when I try to write a ..

Hi is the following possible and if so, any tips on how to do it? This is a dummy version of what I would like to achieve: Define three matrices A, B, and C with A_xy standard normally distributed and B_xy = A_xy for A_xy > 0 and 0 otherwise. Likewise C_xy = A_xy for ..

I am working with Armadillo and there seems to be some weird memory management in my program. I need to solve a matrix system recursively, and for this I call the following function in a for-loop : void get_T(arma::cx_vec &T, arma::mat M0, arma::vec Q, int dim, int nmem){ int n; n = pow(2 * dim, ..

I’ve been trying to serialize the sparse matrix from armadillo cpp library. I am doing some large-scale numerical computations, in which the data get stored in a sparse matrix, which I’d like to gather using mpi(Boost implementation) and sum over the matrices coming from different nodes. I’m stuck right now is how to send the ..

I’m trying to calculate percentiles in c++. I’m already using the armadillo library for other calculations. I’ve found posts outlining the algorithm for Excel’s percentile.exc function. However, I’m wondering if anyone knows how to using an armadillo library function to do the same. Would using the ‘quantile’ function work? If so, do I input the ..

I have a problem where I want to access certain entries of an armadillo-matrix "M" by a pointer in a struct (or class). After initializing M I set the pointer in the struct. By dereferencing the pointer I can see it has the right value (the first entry of M – or M(0,0)). Then I ..

I have a while loop that continues as long as energy variable (type double) has not converged to below a certain threshold. One of the variables needed to calculate this energy is an Armadillo matrix of doubles, named f_mo. In the while loop, this f_mo updates iteratively, so I calculate f_mo at the beginning of ..