[mlpack-git] [mlpack/mlpack] Basic matrix multiplication error when done multiple times (#759)

Mike notifications at github.com
Tue Aug 9 05:46:19 EDT 2016


Hello. I have a mlpack program dealing with products of large matrices ~(100000,400). 
Repeated executions started giving me different results and I have written a few lines example to illustrate such problem: 

 #include <mlpack/core.hpp>
using namespace arma;

int main(void) { 
//Vector declaration & initialisation
     vec a_vector=ones<vec>(400);
     vec fcol=ones<vec>(61);
     mat M = ones<mat>(400,61);
     for (int iter=0; iter<1; iter++){
     a_vector=M*fcol;
     }
std::cout << "i.rows=" << a_vector.n_rows << " i.cols=" << a_vector.n_cols << " i399=" << a_vector(399);
if (a_vector(399)!=61) std::cout << "*" << std::endl;
else std::cout << std::endl;
return 0;
}

Here we find a simple matrix multiplication of matrix * column to obtain a column-> (400,61)*(61,1)=(400,1). 
To check whether this method works I print out the last element of the resulting column. Since all elements are set to 1, any final element should be a sum of 61 elements = 61. 
Well, it turns out that when running it several times these doesn't always hold. 

You can try with a .sh script that runs, say, 80 times. 
This problem is not encountered when using only armadillo. 

The program was compiled through:
"g++ main.cpp -O2 -std=gnu++11 -I/home/usrname/lib/Boost161/include -L/home/usrname/lib/Boost161/lib -larmadillo -lmlpack -I/home/usrname/lib/mlpacklib/include -L/home/usrname/lib/mlpacklib/lib"  

I would be really grateful if someone could shed some light on this. 
[code.zip](https://github.com/mlpack/mlpack/files/408636/code.zip)


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/759
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160809/545c1ba9/attachment.html>


More information about the mlpack-git mailing list