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 ..

#### Category : armadillo

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 ..

When i try to compile my code which uses eig_sym from Armadillo it gives this error Undefined symbols for architecture x86_64: "_wrapper2_dsyev_", referenced from: void arma::lapack::syev<double>(char*, char*, int*, double*, int*, double*, double*, int*, int*) in main-df43f9.o "_wrapper2_dsyevd_", referenced from: void arma::lapack::syevd<double>(char*, char*, int*, double*, int*, double*, double*, int*, int*, int*, int*) in main-df43f9.o ld: symbol(s) ..

In my program, I use many arma::uvecs, and check equality between them like this #include <armadillo> using Vec = typename arma::uvec; Vec v1({0, 0}); Vec v2({0, 1}); bool are_equal arma::all(v1 == v2); as I couldn’t find any better equality operator in the Armadillo docs. Now that works perfectly fine, but to save some space, and ..

According to Armadillo docs: .i() Member function of any matrix expression Provides an inverse of the matrix expression … However, when I try to compile this snippet: #include <armadillo> #include <iostream> arma::sp_mat linReg(arma::sp_mat X, arma::sp_mat Y) { return (X.t() * X).i() * X.t() * Y; } int main() { arma::sp_mat X = arma::sprandu(1000, 10, 0.3); ..

## Recent Comments