I'm doing some basic multiplication using armadillo but for some reason it takes very long to complete. I'm quite new to c++ so I might be doing something wrong, but I can't see it even in this very basic example:
#include <armadillo>
#include <iostream>
using namespace arma;
int main(){
arma::vec coefficients = {1.0, 1.09, 1.08};
arma::mat X = arma::mat(100000, 3, fill::randu) * coefficients;
cout << X.n_cols;
}
when I mean very slow, I have run this example for some minutes and it doesn't finish
EDIT
I run the script with perf stat ./main
, but stopped it after some time because it shouldn't take that long. This is the output.
^C./main: Interrupt
Performance counter stats for './main':
257,169.20 msec task-clock # 1.003 CPUs utilized
3,342 context-switches # 12.995 /sec
215 cpu-migrations # 0.836 /sec
1,312 page-faults # 5.102 /sec
963,025,520,077 cycles # 3.745 GHz
542,959,361,927 instructions # 0.56 insn per cycle
113,002,342,332 branches # 439.409 M/sec
1,095,168,312 branch-misses # 0.97% of all branches
256.349026907 seconds time elapsed
147.860947000 seconds user
109.317743000 seconds sys