Questions tagged [armadillo]
Armadillo is a linear algebra library for C++ that makes use of template metaprogramming and delayed evaluation.
1,059
questions
0
votes
0
answers
7
views
OpenBLAS Link error - qcc (QNX - c++) with armadillo -
Currently creating a process that uses armadillo - this one depends on libopenblas.so
libarmadillo was ported to qnx71/aarch64le and so was libopenblas.
My problem is when I link the libraries, I see ...
1
vote
1
answer
72
views
Armadillo C++ matrix multiplication with in-place assignment to submatrix
Maybe it's a trivial question, but suppose I have two matrices A, B of dimension N x s:
arma::mat A(N, s, arma::fill::randu)
arma::mat B(N, s, arma::fill::randu)
and I need to write a product of ...
1
vote
0
answers
42
views
Error calculating Dunn's Index in c++ using Armadillo library
I have been trying to find Dunns index using the Armadillo library for a larger algorithm I'm working on. Whenever I run the code, I get an output Dunns index:-nan(ind) and an error saying I'm out of ...
0
votes
0
answers
32
views
Why does `eigs_gen` from armadillo give different phases on lowest eigenvalue, when run multiple times
I am using the function eigs_gen from the C++ library Armadillo to find the ground state of a quantum physical Hamiltonian stored as a complex sparse matrix sp_cx_mat H;. It works, but the results ...
0
votes
0
answers
27
views
Errors linking Lapack to CodeBlocks
I am having issues running Armadillo library in my Code::Blocks 20.03 on Windows. I am always stuck on some kind of error and would really appreciate help.
I have downloaded the LAPACK libraries, the ...
0
votes
0
answers
72
views
Column/Rowwise Rank in Armadillo
I have an arma::dmat X of size 4 x 5, and I need to compute the ranks columwise (or, equivalently, rowwise). That is, if X was given by
1.7313004 -0.07725283 0.20853594 0.8234332 1.0856281
-1....
0
votes
1
answer
62
views
no hdf5 files with armadillo 12.6.2 on macos and cluster
I am trying to save an armadillo matrix (mat) to a hdf5 file. I am on a CentOS cluster and using anaconda without root privileges.
Packages installed
I have created an environment arma12 in which I ...
0
votes
1
answer
66
views
Losing decimals when loading a csv into a fmat in C++ using Armadillo
My code is simple:
arma::fmat fromMatlab;
fromMatlab.load(relPath + "/matrix.csv", arma::auto_detect);
My csv contains numbers like:
0 0 2 4.8989795 -6.9282032 -4.8989795 -16....
0
votes
0
answers
42
views
Armadillo C++: most efficient way to calculate using submatrix
Suppose I have two armadillo matrices A and B, and I want to calculate matrix product of two submatrices from both. I wonder what is the most efficient way to achieve it? Thanks
arma::mat A;
arma::mat ...
1
vote
0
answers
30
views
Small matrices in armadillo from numpy via carma
I am trying to create a project using both python (for io and plotting etc.) as well as c++ and armadillo in particular (for heavier computations), linking the two via carma.
I am quite new to c++ and ...
0
votes
0
answers
46
views
Compiling Armadillo C++ Project to WebAssembly (WASM)
I have developed a C++ project that heavily relies on the Armadillo library for numerical computations. Now, I am interested in converting this project into a WebAssembly (WASM) module so that it can ...
2
votes
1
answer
62
views
Multiple .colptr in Armadillo
In Armadillo, there is a pointer to a single column by using .colptr( col_number ). So, we can write, for example,
mat X(nrow, ncol);
vec y(X.colptr(0), nrow, false, true);
X.col(0) = y;
Is there a ...
0
votes
1
answer
48
views
Compute fft with Armadillo using FFTW3 bib
I want to compute fft with armadillo, to improve performance, I have activated the use of the FFTW3 bib.
here is the code:
#define ARMA_USE_FFTW3
#include <armadillo>
int main()
{
arma::vec ...
0
votes
0
answers
60
views
Getting a warning "On entry to CGECON, parameter number 5 had an illegal value" using Armadillo with LAPACK
Before I begin, this really is more of a warning than an error, since it appears my code still functions and gives the correct result, although it's rather annoying to get this message all the time ...
0
votes
0
answers
15
views
Apply user-defined scalar function elementwise to Armadillo array
As the title says, take y = f(x) where x is an array and f is a scalar function. I tried transform() and for_each(), but they don't work for 1D arrays.
double foo(double x) { /* expression with ...
0
votes
0
answers
45
views
Multithreaded construction of large sparse armadillo matrix is slower than single-threaded execution
I'm currently writing a piece of code that has to assemble very large matrices in a location-independent way, i.e the value at any location does not depend on the value at any other location. ...
0
votes
0
answers
40
views
undefined reference to `arma::arma_rng_cxx11_instance' [duplicate]
Trying to compile using CLion on ubuntu 20.04.5 LTS the example code given in Armadillo documentation but getting errors such as:
undefined reference to `arma::arma_rng_cxx11_instance'
here is the ...
0
votes
0
answers
25
views
Neat way to template functions using Armadillo's objects? [duplicate]
I don't use templates often, but I started working with Armadillo's library which has several different array and matrix types, and I wanted to write templates to cover versatile inputs instead of ...
1
vote
1
answer
101
views
Problem in modifying shared armadillo matrix with OpenMP
I tried using omp in RcppArmadillo in the following toy example
#include <RcppArmadillo.h>
#include<omp.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::plugins(cpp11)]]
// [[Rcpp::...
2
votes
1
answer
70
views
Catching LAPACK errors in Armadillo
I'm attempting to calculate the SVD of a matrix using RcppArmadillo.svd() is supposed to return 0 if the SVD failed. However, I have encountered a matrix for which I get the error code BLAS/LAPACK ...
0
votes
0
answers
19
views
Code sample exits during call to shed_col() without giving an error message
The sample code shown below exits when calling shed_col() without giving an error message. It does not continue to the next line in the source code (not shown). I am trying to remove the last column....
0
votes
0
answers
30
views
Struggles to make RcppArmadillo work with openMP in R package
I am working on a R package that relies on the functionality of the armadillo C++ library through RcppArmadillo and have troubles making it work in parallel with openMP. So my questions are about the ...
1
vote
1
answer
77
views
How to create a commutation matrix in C++ (using either Eigen or Armadillo?)
I am wondering how to create a commutation matrix (see https://en.wikipedia.org/wiki/Commutation_matrix#MATLAB) in C++ using either the Eigen or Armadillo libraries. There is some MATLAB code on the ...
0
votes
0
answers
50
views
arma::memory::acquire(): requested size is too large
I try to run the mm command using fsl (version 6.0.6.4 for Ubuntu 20, 64-bit), but the process stop with a std logic error, as follows:
mm --ld=logdir --sdf="/home/jovyan/work/persistent/vol0000....
0
votes
1
answer
123
views
(C++) Why does armadillo `eigs_gen` break when multithreading?
TLDR
The C++ armadillo libraries function for finding eigenvalues and eigenvectors of a complex sparse matrix eigs_gen fails (crashes or give wrong result) if run concurrently in multiple threads, ...
1
vote
1
answer
660
views
Eigen methods in C++ library (OpenCV, Eigen, Armadillo) considerably slower than MATLAB
I am trying to compute Eigen vectors for a matrix in C++ in a very efficient way. The problem is that the most representative C++ libraries OpenCV, Eigen and Armadillo are considerably slower than ...
0
votes
0
answers
64
views
Why do I get either a double free or corruption (out) or a C malloc assertion failure?
I am writing a code for a physics simulation, evolving some copies of the initial state with a stochastic and a deterministic evolution, returning the the value of some observable at each timestep of ...
0
votes
0
answers
85
views
c++ vscode debgging : can't access element of armadillo matrix
I am trying to debug a c++ program from the vs code debug console, and I'd like to access some elements of an armadillo matrix, however when i try to acces the matrix I get the following:
-> matrx....
0
votes
0
answers
106
views
How to resolve warning related to deprecated armadillo function in C++
I am very new to C++, and I am using the C++ library (armadillo) for my UG project. I was using a computer on which armadillo was already installed. When I compiled the code, it was warning-free. Very ...
0
votes
1
answer
50
views
Armadillo with wxWidgets: polyfit fails to link
I have been using wxWidgets to make visual examples of a few of Armadillo's functions. Both matrix transpose and FFT worked perfectly, but when I tried to do a simple polyfit call, the linker fails ...
0
votes
0
answers
85
views
When using Rcpp, I get "error: no viable overloaded '='. How can I resolve this?
I am using Rcpp, and I'm struggling to resolve the "error: no viable overloaded '='. I believe that I'm using the correct set-up, where I load the R package mvtnorm, which contains the rmvnorm ...
0
votes
1
answer
104
views
Using MPI with Armadillo C++ for parallel diagonalization
There has been a post regarding usage of MPI with Armadillo in C++: here
My question is, wether Lapack and OpenBlas did implement MPI support?
I could not anything so far in their documentations.
...
0
votes
1
answer
175
views
Armadillo lapack linker error when using Visual Studio
The simple program below makes a call to polyfit to find the best line through the data points.
#include <iostream>
#include <vector>
#include <armadillo>
using arma::vec;
using ...
0
votes
1
answer
164
views
Intel MKL ERROR: Parameter 7 was incorrect on entry to DGELSD when including both Armadillo and Open3D in cpp
I am working on a cpp-project based on Open3D and armadillo on Ubuntu18.04. After adding Open3D::Open3D to linked libraries, some functions from armadillo like arma::inv(A) and arma::solve(X, A, B) ...
0
votes
1
answer
135
views
NaN's are getting reported as 0 while compiling with icpx and not as NaN
On running this program, in the output Nan"s are being reported as 0, when building with icpx V2022.1, it is working fine with other compilers.
Compiling with the command: icpx -O3 -qmkl=...
0
votes
1
answer
40
views
setting up the Eclipse for Rcpp/Armadillo
I am new to area of writing functions for using in R using Rcpp and Armadillo. I was looking trough the Tutorials and other questions which asked about this topic, but I was not able to find something ...
1
vote
0
answers
24
views
How to initilize armadillo matrix from armadillo vectors?
I want two set up a matrix arma::mat from column vectors arma::vec.
M = mat(v1, v2, ...)
What is the best way to do this?
0
votes
0
answers
33
views
Code::Blocks and Armadillo Linking: cannot find -lopenblas.lib
I want to link armadillo-11.4.0 to Code::blocks C++ project in Windows 11. I already gave the path to include folder and library folder using Project Build options>>Search directories. Also, in ...
2
votes
2
answers
127
views
Armadillo sizeof(arma::Mat) gives different results between GCC and NVCC
#include <iostream>
#include <armadillo>
using namespace std;
int main()
{
arma::Mat<float> a;
cout << sizeof(a) << "\n";
return 0;
}
The above ...
0
votes
1
answer
181
views
RcppArmadillo returns pinv(): svd failed
I have a matrix A and a vector b, I want to solve the linear system Ax = b for x. The problem is that frequently A will be singular. I used RcppArmadillo package in R to do this. Basically I do
arma::...
0
votes
1
answer
157
views
Why does my RcppParallel implementation of a user-defined function crash unexpectedly?
I have developed a dual chain markov monte carlo model designed to forecast loan portfolios in the excellent package Rcpp but have run into an issue trying to implement a parallelised version of these ...
1
vote
0
answers
123
views
overwrite all values of a sparse matrix in rcpp armadillo
I'm getting started with rcpp and am not sure how to convert a portion of my code to c++
My process uses sparse matrices in which the elements are all operated on as vectors then inserted back into a ...
0
votes
1
answer
46
views
In Armadillo is it possible to set the memory after the variable has been declared?
I have a class with an Armadillo vector as an instance variable. I know that I can create an Armadillo vector using a memory location as a constructor argument. However, I don't see a way to set the ...
0
votes
1
answer
98
views
Strange/inconsistent behavior with armadillo with `copy_aux_mem` and solving with a triangular matrix
Consider the following C++ code
// [[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
// [[Rcpp::export(rng = false)]]
void possible_bug(arma::vec &x, arma::mat const &sig_chol)...
0
votes
1
answer
43
views
Armadillo prints the imaginary part of a complex value as negative when transposed
The armadillo print() method prints the imaginary value as the negative of its true value when transposing the column vector to a row vector. Is this a bug, or am I missing something?
Code:
#include &...
0
votes
0
answers
103
views
Why parallel matrix multiplication takes so long time?
I create test code where I am computing in parallel one complex matrix.
I am computing on CPU.
I observed that it takes around 3 seconds to finish all the blocks.
Can someone explain why it takes so ...
1
vote
0
answers
339
views
Linking LAPACK and BLAS libraries to a C++ program using Armadillo, in Ubuntu 18.04: What changes should I make in the Makefile?
I am a beginner in programming in C++. I have a program in C++ that uses Armadillo (a linear algebra library that uses LAPACK and BLAS), which is directly included in my scripts. The functionality of ...
1
vote
0
answers
169
views
C++ Armadillo eigenvalues for large sym matrix
In my program I use armadillo to repeatedly perform eigenvalue computations on a large dense real symmetric matrix. The corresponding function should be
arma::mat H = ...; //dense, real, symmetric >...
0
votes
1
answer
185
views
Fastest way to fill complex matrix with incoming data. Armadillo Library
I have situation where each 1ms is coming new buffer of 2*200 samples of int16_t. (multiplied by 2 is because complex data)
Those data should be added into Armadillo Complex Double Matrix, in the ...
1
vote
3
answers
290
views
C++ performance optimization for linear combination of large matrices?
I have a large tensor of floating point data with the dimensions 35k(rows) x 45(cols) x 150(slices) which I have stored in an armadillo cube container. I need to linearly combine all the 150 slices ...