Hello Mata Statalist,
Doing a task in mata I have not run into before.
I currently have a huge vector of values (~5 million rows) we will call vector x. I have a huge matrix 5 million values x 250 values lets call matrix M. The basic idea I'm trying to accomplish is to remove any value in the matrix M that is = any value from the vector x.
The only idea I had (which would take far too long on so many values) was going to be to create a vector v with the same value repeated through the whole vector from the first value of vector x from the first value of the vector J(5000000,1,x[1]) and loop through each column of the matrix to subtract this vector from each column, and replace the zeros that result with missing values. Then to loop that all the way through the 5 million rows. . . brutal.
Does anyone have a better idea of a way to do this?
Thanks,
Neal
Doing a task in mata I have not run into before.
I currently have a huge vector of values (~5 million rows) we will call vector x. I have a huge matrix 5 million values x 250 values lets call matrix M. The basic idea I'm trying to accomplish is to remove any value in the matrix M that is = any value from the vector x.
The only idea I had (which would take far too long on so many values) was going to be to create a vector v with the same value repeated through the whole vector from the first value of vector x from the first value of the vector J(5000000,1,x[1]) and loop through each column of the matrix to subtract this vector from each column, and replace the zeros that result with missing values. Then to loop that all the way through the 5 million rows. . . brutal.
Does anyone have a better idea of a way to do this?
Thanks,
Neal
Comment